Customise Cart module template

  • Posts: 232
  • Thank you received: 4
  • Hikaserial Standard Hikashop Business
4 years 5 months ago #326074

-- 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

Attachments:

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

  • Posts: 83799
  • Thank you received: 13571
  • MODERATOR
4 years 5 months ago #326081

Hi,

It's indeed the same view file used in both places.
In listing_price.php you can have such 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.

  • Posts: 232
  • Thank you received: 4
  • Hikaserial Standard Hikashop Business
4 years 5 months ago #326122

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).' '.JText::_('PRICE_WITH_TAX').'</span>';
}

Last edit: 4 years 5 months ago by ltempest.

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

  • Posts: 83799
  • Thank you received: 13571
  • MODERATOR
4 years 5 months ago #326132

Hi,

Yes this sounds good.

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

Time to create page: 0.058 seconds
Powered by Kunena Forum