| ||||||||||
![]() |
Shopping cart software Solutions for online shops and malls | |||||||||
![]() |
![]() |
|
X-Cart Home | ![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Can't access custom variable | ||||
![]() |
|
|
Thread Tools | Search this Thread |
#1
|
|||||||||
|
|||||||||
![]() Hi All,
I have a modified mini-cart. I want to also input a text line, such as "Only ё3.40 until FREE SHIPPING!" To do this, I have created a variable that looks at my shipping tables. I want to make sure that my minicart always reads whatever value is in a certain shipping method, that qualifies them for free shipping. If we ever changed the threshold, I won't have to change the template. Bearing that in mind, the variable does now appear in "Webmaster Mode" {$free_shipping_subtotal_requirement}Array (1)0 => Array (1) mintotal => "25.00" I want to be able to access the "mintotal" value. However, even as a starting point, I can't reference it in a template - It just comes out as blank ![]() Have I missed something fundamental that will allow me to get to that? Or, should I just be able to call it, if it's populated - Which it is doing - And contains the correct value? Any help will be hugely appreciated! ![]() Thank you!
__________________
4.2.3 X-Cart Gold BCSE Address Book | XCartMods QuickFind | X-RMA | X-Offers -------[installed]----------------------[installed]--------------[installed]----[installed]-- 5: in development ![]() |
|||||||||
#2
|
|||||||||
|
|||||||||
![]() You have to assign it to smarty form the php file before you can access it in template
$smarty->assign("variable_name_in_template", $variable_name_in_php);
__________________
Steve Stoyanov CFLSystems.com Web Development |
|||||||||
|
#3
|
|||||||||
|
|||||||||
![]() I have this in the .php file - ?
$smarty->assign("free_shipping_subtotal_requirement",$free _shipping_subtotal_requirement);
__________________
4.2.3 X-Cart Gold BCSE Address Book | XCartMods QuickFind | X-RMA | X-Offers -------[installed]----------------------[installed]--------------[installed]----[installed]-- 5: in development ![]() |
|||||||||
#4
|
|||||||||
|
|||||||||
![]() Does $free _shipping_subtotal_requirement holds the array or is it just a text?
__________________
Steve Stoyanov CFLSystems.com Web Development |
|||||||||
#5
|
|||||||||
|
|||||||||
![]() It's the result of:
$query = "SELECT mintotal FROM `xcart_shipping_rates` where rate = '0' and shippingid = '173'"; But that's as much as I know ... ?
__________________
4.2.3 X-Cart Gold BCSE Address Book | XCartMods QuickFind | X-RMA | X-Offers -------[installed]----------------------[installed]--------------[installed]----[installed]-- 5: in development ![]() |
|||||||||
#6
|
|||||||
|
|||||||
![]() FYI, there's a couple similar mods already available on here..
http://forum.x-cart.com/showthread.php?t=28275 http://forum.x-cart.com/showthread.php?t=17500
__________________
xcartmods.co.uk |
|||||||
|
#7
|
|||||||||
|
|||||||||
![]() Hi Phil,
Thanks for those - Seems I am sort of on the right track. I have already modified the minicart to do this, with a fixed value of "25" - Only when the user is delivering to the UK. However, I don't want to fix the 25 in the template - The likelihood is, with everything else that I have to do, I will forget that it's there in a couple of years - If we ever change our rules - I want to eliviate this. The 25, as above, comes from our horrendous 485 line shipping table - When the delivery method is Royal Mail & the charge is 0. This will give us an accurate reading of the "free postage" threshold - Without any other manual intervention. Our shipping table is a direct sync from our backoffice setup, so if it changes there, it will change in x-cart.
__________________
4.2.3 X-Cart Gold BCSE Address Book | XCartMods QuickFind | X-RMA | X-Offers -------[installed]----------------------[installed]--------------[installed]----[installed]-- 5: in development ![]() |
|||||||||
#8
|
|||||||||
|
|||||||||
![]() Since the only value you need is mintotal you can do this
Code:
__________________
Steve Stoyanov CFLSystems.com Web Development |
|||||||||
|
#9
|
|||||||||
|
|||||||||
![]() Strangely, my xcart didn't like calling the table name ...?
I've popped this in instead and it seems to work? $mintotal = func_query_first_cell("SELECT mintotal FROM `xcart_shipping_rates` where rate = '0' and shippingid = '173'"); $smarty->assign("mintotal",$mintotal); Dropped it into the equation and it works perfectly! Faaaaantastic! Whoop! Thank you, Steve! ![]()
__________________
4.2.3 X-Cart Gold BCSE Address Book | XCartMods QuickFind | X-RMA | X-Offers -------[installed]----------------------[installed]--------------[installed]----[installed]-- 5: in development ![]() |
|||||||||
#10
|
|||||||||
|
|||||||||
![]() My bad, sorry, the table must be without "xcart_"
Code:
__________________
Steve Stoyanov CFLSystems.com Web Development |
|||||||||
|
|||
X-Cart forums © 2001-2020
|