acateon Posted January 29, 2014 Share Posted January 29, 2014 (edited) Does anyone have any ideas of how to display available vouchers on product.tpl? To be more specific, only show vouchers that are available for this specific product or the category its in. I'm thinking something of the line of:{if $voucherAvailable} {foreach from=$displayVouchers item=voucher} <p>Take use of this voucher and save {$voucherValue} - {$voucherCode}</p> {/foreach} {/if} The reason for this is that I don't want to show the reduced price unless you visit the product page. Would love some help with this, thanks in advance! Edit: I'm using PS 1.4.10.0 Edited January 29, 2014 by acateon (see edit history) Link to comment Share on other sites More sharing options...
CartExpert.net Posted January 29, 2014 Share Posted January 29, 2014 Hi. You can a have a look at how the cart is displaying the vouchers. Regards.Robin.The CartExpert Team Link to comment Share on other sites More sharing options...
acateon Posted January 29, 2014 Author Share Posted January 29, 2014 (edited) Hi. You can a have a look at how the cart is displaying the vouchers. Regards. Robin. The CartExpert Team Hey! Thanks for your reply! The variables in shopping-cart.tpl are not applicable in product.tpl, I guess I need to modify productcontroller...? The only one that seems to work is {if $voucherAllowed} but the foreach loop with $displayVouchers does nothing. Edit: neither does {$voucher.name} - {$voucher.description} Edited January 29, 2014 by acateon (see edit history) Link to comment Share on other sites More sharing options...
CartExpert.net Posted January 29, 2014 Share Posted January 29, 2014 Hi. Of course it will not, you need to assign a value to the variables. CartRule::getCustomerCartRules function will give you an idea on how to do it. Also you can check ParentOrderController to see how the return value of the function is processed. Regards.Robin.The CartExpert Team Link to comment Share on other sites More sharing options...
acateon Posted February 7, 2014 Author Share Posted February 7, 2014 (edited) Thanks for pointing me in the right direction. I´ve tried back and forth with really no success at all. Guess I'm in quite a bit over my head. I've tried adding the following to the product controller: $discounts = self::$cart->getDiscounts(); $discountName = $cart->{Tools::getValue ('discount_name')}; //$discount = new Discount((int)($this->product->id),(Discount::getIdByName($discountName))); self::$smarty->assign(array( 'discount_name' => Tools::safeOutput($discounts), 'displayVouchers' => Discount::getVouchersToCartDisplay((int)(self::$cookie->id_lang)), )); Just scrap at the moment, but could anyone give me some tips? As of now I have no idea really of what I'm doing. Edited February 7, 2014 by acateon (see edit history) Link to comment Share on other sites More sharing options...
HARI DUDDELA Posted September 8, 2015 Share Posted September 8, 2015 Does anyone have any ideas of how to display available vouchers on product.tpl? To be more specific, only show vouchers that are available for this specific product or the category its in. 1 Link to comment Share on other sites More sharing options...
cosmokrator Posted June 13, 2016 Share Posted June 13, 2016 This is a very nice idea and still no responses. Anyone can help? Link to comment Share on other sites More sharing options...
Nickovitshj Posted February 23, 2022 Share Posted February 23, 2022 Anyone with a good solution on this? Link to comment Share on other sites More sharing options...
Nickovitshj Posted February 23, 2022 Share Posted February 23, 2022 I found a solution for my problem, see thread linked below. Thread: Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now