Jump to content

Customize Fancy Box


snqke

Recommended Posts

Hello,

 

I'd like to customize the box for packages that i sell 

for example 

{{if $smarty.session.status_id!=3}} {{* do not show this link for premium users *}}
<a data-href="{{if $smarty.session.user_id>0}}{{$lang.urls.upgrade}}/?service_id=13{{else}}{{$lang.urls.login_required}}{{/if}}" data-fancybox="ajax">Remove Ads/Get Premium</a>
{{/if}}

instead of showing the standard box view (in the screenshot), i'd like to create a new custom one and display it 

 

 

Capture d'écran 2024-02-15 123712.png

Link to comment
Share on other sites

We have standard user that clicked on remove/ads button and i redirect to this package "

{{$lang.urls.upgrade}}/?service_id=13

and when he choose one of these packages (check screenshot 1)

screenshot1.thumb.png.fd3c007cbedd59522fe7c5eeecd70eb8.png

he got error message because he don't have enough token , 

so i want to custom that popup and add a text "PURCHASE TOKENS" near the button "purshase" and when he click on it it will open the second popup 

like the screenshot 2 

screenshot2.png.000ee37702a726f078d4220dc47fea51.png

 

Thats why :)

Link to comment
Share on other sites

First of all you can add an error message into Website UI -> Texts having the following external ID:

validation.upgrade.not_enough_tokens

To show a better error message on this.

To put a link to purchase tokens, you can update Upgrade block template in Website UI -> Global blocks -> Upgrade Access and put your token purchase link as the following:

{{if !isset($smarty.get.service_id)}}
<a data-href="{{$lang.urls.upgrade}}?service_id=13" data-fancybox="ajax">Get more tokens</a>
{{/if}}

So basically it will open the same popup, but with additional parameter to trigger specific payment processor. The {{if}} condition is needed so that this link doesn't appear when you open another instance of this popup.

Link to comment
Share on other sites

Thanks for reply ,

where do i need to place the text error message because i tried to find this message 

{{$lang.validation.common.unknown_error}}

and i didn't find it into the Global block "Upgrade Access", and i'm not able to place the text message 

{{if $async_submit_successful=='true'}}
	<div class="success" data-fancybox="refresh">
		{{if $smarty.session.status_id==3}}
			{{$lang.upgrade.success_message_premium_member|replace:"%1%":$lang.project_name}}
		{{else}}
			{{$lang.upgrade.success_message_active_member|replace:"%1%":$lang.project_name}}
		{{/if}}
	</div>
{{else}}
	<strong class="popup-title">{{$lang.upgrade.title}}</strong>
	<div class="popup-holder">
		<form action="{{$lang.urls.upgrade}}" data-form="ajax" method="post">
			<div class="generic-error hidden"></div>
			
			{{if count($card_packages)>0}}
				<div class="button-group">
					{{foreach item="item" from=$card_packages}}
						<div class="row">
							<div class="toggle-button inversed {{if $item.is_default==1}}active{{/if}}" data-action="choose">
								<input type="radio" class="radio" name="card_package_id" value="{{$item.package_id}}" {{if $item.is_default==1}}checked{{/if}}/>
								<span>{{$lang.memberzone.access_packages[$item.external_id]|default:$item.title}}</span>
							</div>
						</div>
					{{/foreach}}
					{{if count($access_codes)>0}}
						<div class="row">
							<div class="toggle-button inversed" data-action="choose">
								<input type="radio" class="radio" id="i_have_access_code"/>
								<span>{{$lang.signup.field_option_access_code}}</span>
								<script>
									$('#i_have_access_code').on('change', function() {
										$('#upgrade_access_code').val('').parent().css('display', $(this).prop('checked') ? 'block' : 'none');
									});
								</script>
							</div>
						</div>
					{{/if}}
				</div>
			{{/if}}

			{{if count($access_codes)>0}}
				<div class="row" {{if count($card_packages)>0}}style="display: none"{{/if}} data-name="payment_option">
					<label for="upgrade_access_code" class="field-label">{{$lang.signup.field_access_code}}</label>
					<input id="upgrade_access_code" type="text" name="access_code" class="textfield" data-name="card_package_id"/>
					<div class="field-error down"></div>
				</div>
			{{/if}}

			<div>
				<div class="bottom">
					{{if count($card_packages)>0}}
						<input type="hidden" name="payment_option" value="2"/>
					{{/if}}
					<input type="hidden" name="back_link" value="{{$lang.urls.payment_action}}"/>
					<input type="hidden" name="action" value="upgrade"/>
					<input type="submit" class="submit" value="{{$lang.upgrade.btn_purchase}}"/>
				</div>	
				<div class="bottom">
					<a data-href="{{$lang.urls.upgrade}}?service_id=12" data-fancybox="ajax" class="submit">Get more tokens</a>
				</div>
			</div>
			
		</form>
					
	</div>
{{/if}}

Also when i place this condition

{{if !isset($smarty.get.service_id)}}
<a data-href="{{$lang.urls.upgrade}}?service_id=13" data-fancybox="ajax">Get more tokens</a>
{{/if}}

it show for me like this 

Capturedcran2024-02-16133232.png.dac7dab6dc58f37f23630a3699f803b0.png

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...