![]() |
Can't access custom variable
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! |
Re: Can't access custom variable
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); |
Re: Can't access custom variable
I have this in the .php file - ?
$smarty->assign("free_shipping_subtotal_requirement",$free _shipping_subtotal_requirement); |
Re: Can't access custom variable
Does $free _shipping_subtotal_requirement holds the array or is it just a text?
|
Re: Can't access custom variable
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 ... ? |
Re: Can't access custom variable
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 |
Re: Can't access custom variable
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. |
Re: Can't access custom variable
Since the only value you need is mintotal you can do this
Code:
|
Re: Can't access custom variable
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! :D/ |
Re: Can't access custom variable
My bad, sorry, the table must be without "xcart_"
Code:
|
All times are GMT -8. The time now is 12:03 AM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.