Customize the add to cart and quantity in product

  • Posts: 10
  • Thank you received: 0
11 years 4 months ago #109931

Hello.

Inside the product page i want to customize the way the add to cart button and quantity option is displayed.
In the Product - show_default view there is a div with a php code that seems to display this.
Is this code calling another view where i can customize with css the way the add to cart button and quantity option is shown?

Here's the div in the show_default view that contains this:

<div id="hikashop_product_quantity_main" class="hikashop_product_quantity_main">
<?php
$this->row = & $this->element;
$this->ajax = 'if(hikashopCheckChangeForm(\'item\',\'hikashop_product_form\')){ return hikashopModifyQuantity(\'' . $this->row->product_id . '\',field,1' . $form . ',\'cart\'); } else { return false; }';
$this->setLayout('quantity');
echo $this->loadTemplate();
?>
</div>


I'll apreciate any help.

Regards.

Last edit: 11 years 4 months ago by Tangram.

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

  • Posts: 13201
  • Thank you received: 2322
11 years 4 months ago #109993

Hi,

You have to do a template override, there is some documentation about it here:
www.hikashop.com/fr/support/documentatio...tation.html#override

For the quantity input:

You need to create the file templates/YOUR_TEMPLATE/html/hikashop_button.php. We invite you to look at the file administrator/components/com_hikashop/helpers/cart.php for the default code of the function you will define in it. In that file, you will be able to define the function:

hikashop_quantity_render($html,$i,$max_quantity,$min_quantity) => The $html variable will contain the HTML of the "add to cart" button, the $i variable will contain a unique int which will be different for each quantity input on the page, the $max_quantity and $min_quantity will contain the min and max quantity possible for the product. You need to return the whole HTML at the end of your function.

Also, please note that it only works if the option for "Display the quantity field on the product page" is set to "Ajax Input" in the configuration of HikaShop.

The following user(s) said Thank You: Tangram

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

Time to create page: 0.062 seconds
Powered by Kunena Forum