Skip to main content

Customise Cart module template

6 years 1 week ago #326074 by ltempest
-- HikaShop version -- : 4.30
-- Joomla version -- : 3.9.22

Help!
How can I create two different views for the product page and the Cart module. When I turn on the files view, it shows that the same template is being loaded in both the product page and the cart module, specifically the product/listing_price.php file. See the attached screenshot. I want to simplify the cart module display and only include the non tax price in the module. However, when I edit the listing_price.php template file it affects the main product display which I wish to keep as it currently displays. I know I could use CSS such as display:none but that does not seem to be the 'correct' way!

Thanks
Lee

Please Log in or Create an account to join the conversation.

6 years 1 week ago #326081 by nicolas
Hi,

It's indeed the same view file used in both places.
In listing_price.php you can have such code:
Code:
if(!empty($this->element->cart_id)) { echo 'I am in the cart'; } else { echo 'I am not in the cart'; }
That way, you can display the prices differently based on where you are.

Please Log in or Create an account to join the conversation.

6 years 1 week ago - 6 years 1 week ago #326122 by ltempest
Nicolas,
Thanks for the quick reply. I kinda understand your code, but where in the listing_price.php file would this be added? Can you advise around which line number?

Thanks

UPDATE: I think i found it around line 135 and changed to:

if(!empty($this->element->cart_id)) {
echo '<span class="hikashop_price_exvat"><span class="hikashop_price_figure">'.$this->currencyHelper->format(@$price->price_value, $price->price_currency_id).'</span>'.JText::_('PRICE_BEFORE_TAX').'</span>';
} else {
echo '<span class="hikashop_price_exvat"><span class="hikashop_price_figure">'.$this->currencyHelper->format(@$price->price_value, $price->price_currency_id).'</span>'.JText::_('PRICE_BEFORE_TAX').'</span>';
echo '<span class="hikashop_price_withvat">'.$this->currencyHelper->format(@$price->price_value_with_tax, $price->price_currency_id).'&nbsp;'.JText::_('PRICE_WITH_TAX').'</span>';
}
Last edit: 6 years 1 week ago by ltempest.

Please Log in or Create an account to join the conversation.

6 years 1 week ago #326132 by nicolas
Hi,

Yes this sounds good.

Please Log in or Create an account to join the conversation.

Time to create page: 0.054 seconds
Powered by Kunena Forum