Jump to content

I Need to modify blockcart.tpl


Recommended Posts

Ok so i have a custom payments module (for NZ using DPS) and I need to modify blockcart.tpl so i pushes the user currency through not the stores default currency, every thing i have tried either doesnt work or works but breaks my layout (right column disappears)

on blockcart.tpl around line 32 is the code I have figured out i need to modify

{if $cart_qties > 0}{convertPrice price=$cart->getOrderTotal(true)}{/if}

some how i need to add in to use the customer currency not the stores default currency...


any help greatly appreciated

LM

Link to comment
Share on other sites

so I need the proper formatting of this

{if $cart_qties > 0}{convertPrice price=$cart->getOrderTotal(true), $currency}{/if}

as that works but breaks the right side column - the one that blockcart is assigned too

can any one tell me how to write that code properly so it doesn't break the hook?

Link to comment
Share on other sites

ok so in blockcart.php on starting at line 33 there is

// Set currency
if (!intval($params['cart']->id_currency))
   $currency = new Currency(intval($params['cookie']->id_currency));
else
   $currency = new Currency(intval($params['cart']->id_currency));
if (!Validate::isLoadedObject($currency))
   $currency = new Currency(intval(Configuration::get('PS_DEFAULT_CURRENCY')));



how do then set/pass this to blockcart.tpl

again about line 32/33

{if $cart_qties > 0}{convertPrice price=$cart->getOrderTotal(true)}{/if}
this dont work...
{if $cart_qties > 0}{convertPrice price=$cart->getOrderTotal(true) currency=$currency}{/if}

can any one help me? smarty gurus, presta developers, general hacks? anyone????

Link to comment
Share on other sites

Try changing lines 48-49 of blockcart.php (in PrestaShop v1.3.1) from:

$smarty->assign(array(
   'products' => $products,



to:

$smarty->assign(array(
   'cart_currency' => $currency,
   'products' => $products,



then use the following:

{if $cart_qties > 0}{convertPrice price=$cart->getOrderTotal(true) currency=$cart_currency}{/if}



This will use the currency from blockcart.php instead of the global currency. Of course, it won't work if the cart currency is the same as the global currency.

Link to comment
Share on other sites

ok so what I am trying to do is keep the user currency in the cart until the checkout process is complete,

at the moment it switches currencies fine but when you go to check out it converts it back to the default shop currency, which is where my problem lies or as I have just found out if you swtich back to the default currency it stays at the "other" currency...

the live site is www.me-tailtherapy.co.nz

I need it to stay with the user currency (in this case AUD) rather than switching to the default currency (NZD) as I am getting payment errors on sales (customers not paying enough for a product)

hope that explains it better

LM

Link to comment
Share on other sites

Maybe you are making this more difficult than it needs to be. What do you have set on the Payment tab under "Currency restrictions"? Do you "Customer currency" or "Shop default currency" selected? It sounds like you might have "Shop default currency" selected when you want "Customer currency".

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...