customize add to cart button

  • Posts: 5
  • Thank you received: 0
11 years 2 months ago #118871

It is possile to add (in my case) the "add_to_cart" button in category layout:
Got this in quantity.php:

$this->cart->displayButton(JText::_('CHOOSE_OPTIONS'),'choose_options',$this->params,hikashop_completeLink('product&task=show&product_id='.$this->row->product_id.'&name='.$this->row->alias.$this->itemid.$this->category_pathway),' window.location = \''.str_replace("'","\'",hikashop_completeLink('product&task=show&product_id='.$this->row->product_id.'&name='.$this->row->alias.$this->itemid.$this->category_pathway)).'\';return false;','');
I want to add a css class. But where is the button composed?

Last edit: 11 years 2 months ago by Jerome. Reason: use code tags

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

  • Posts: 26151
  • Thank you received: 4027
  • MODERATOR
11 years 2 months ago #118902

Hi,

The function is a function in the Cart Helper. It is not a function that you can change easily (because it is in the HikaShop core, so your modification will be remove with HikaShop updates).
We will see to change and improve this function, it is in our TODO list for some refactoring parts.

For the moment, I can recommend you to use the code from the cart helper (administrator/components/com_hikashop/helper/cart.php) and put it directly in your view override.
It will be easier for you to change some elements without loosing them with updates.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 5
  • Thank you received: 0
11 years 2 months ago #118985

thanks for the fast reply.

next question:
where is the hikashop_product_stock composed?

i mean this form in which you can type the quantitiy with the "+" and "-" buttons

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

  • Posts: 26151
  • Thank you received: 4027
  • MODERATOR
11 years 2 months ago #119000

Hi,

I think you want to override the quantity input field, like explain in our developer documentation.
www.hikashop.com/support/documentation/6...tation.html#override

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 5
  • Thank you received: 0
11 years 2 months ago #119033

some examples are very usefull
maybe for function hikashop_image_toggle_js(&$obj){
??
}

Last edit: 11 years 2 months ago by akroll.

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

  • Posts: 26151
  • Thank you received: 4027
  • MODERATOR
11 years 2 months ago #119074

Hi,

I don't understand why your are talking about the function "hikashop_image_toggle_js".
I said that you have to override the quantity input field.

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.


regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 5
  • Thank you received: 0
11 years 2 months ago #119142

Sorry, I've been to the next question.
I want to override the output of the small images on the product page.

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

  • Posts: 26151
  • Thank you received: 4027
  • MODERATOR
11 years 2 months ago #119163

Hi,

Ok, I see !

We don't provide example because you have to copy the code from the indicated file.
In the case of the function "hikashop_image_toggle_js", it is the helper image file.

When you open it, you can search for the text "hikashop_image_toggle_js" in the file and you will see the default javascript content include in the helper file.
The override is just a simple php file with a function which will return some "text", you can copy paste the javascript content in the helper image file as the base.

This override will be improved, we are currently working on a new image system for HikaShop.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

Time to create page: 0.068 seconds
Powered by Kunena Forum