- Posts: 24
- Thank you received: 0
How to create 2 Different Add To Cart Buttons
15 years 3 months ago #18678
by axyswebs
How to create 2 Different Add To Cart Buttons was created by axyswebs
Hi
I would like to use a different add-to-cart button for each product category or at least have different wordings for the add-to-cart buttons in each category. Hope you can help??
Thanks
Tony
I would like to use a different add-to-cart button for each product category or at least have different wordings for the add-to-cart buttons in each category. Hope you can help??
Thanks
Tony
Please Log in or Create an account to join the conversation.
15 years 3 months ago #18691
by nicolas
Replied by nicolas on topic Re: How to create 2 Different Add To Cart Buttons
Hi,
You should use a button template override: www.hikashop.com/support/documentation/6...tation.html#override
You will have to get the id of the product on the page (or the id of the category for the products listing on the page) from the request and then load the category of the product ( or the category from the category id of the request ) and then display the button accordingly.
You should use a button template override: www.hikashop.com/support/documentation/6...tation.html#override
You will have to get the id of the product on the page (or the id of the category for the products listing on the page) from the request and then load the category of the product ( or the category from the category id of the request ) and then display the button accordingly.
Please Log in or Create an account to join the conversation.
14 years 10 months ago #29460
by axyswebs
Replied by axyswebs on topic Re: How to create 2 Different Add To Cart Buttons
Hi
I am wanting to show an alternative text for the add to cart link. I currently have an override ADD_TO_CART="Request CA" but would like to show different text for another category. Is this possible in this code?
<?php
if($this->params->get('show_price')){
$this->setLayout('listing_price');
echo $this->loadTemplate();
}
if($this->params->get('add_to_cart')){
?><form action="<?php echo hikashop::completeLink('product&task=updatecart'); ?>" method="post" name="hikashop_product_form_<?php echo $this->row->product_id.'_'.$this->params->get('main_div_name'); ?>"><?php
$this->ajax='';
$this->setLayout('quantity');
echo $this->loadTemplate();
?>
<input type="hidden" name="product_id" value="<?php echo $this->row->product_id; ?>" />
<input type="hidden" name="add" value="1"/>
<input type="hidden" name="ctrl" value="product"/>
<input type="hidden" name="task" value="updatecart"/>
</form><?php
}
?>
Or do I need a programmer to do as you have suggested above?
Thanks
I am wanting to show an alternative text for the add to cart link. I currently have an override ADD_TO_CART="Request CA" but would like to show different text for another category. Is this possible in this code?
<?php
if($this->params->get('show_price')){
$this->setLayout('listing_price');
echo $this->loadTemplate();
}
if($this->params->get('add_to_cart')){
?><form action="<?php echo hikashop::completeLink('product&task=updatecart'); ?>" method="post" name="hikashop_product_form_<?php echo $this->row->product_id.'_'.$this->params->get('main_div_name'); ?>"><?php
$this->ajax='';
$this->setLayout('quantity');
echo $this->loadTemplate();
?>
<input type="hidden" name="product_id" value="<?php echo $this->row->product_id; ?>" />
<input type="hidden" name="add" value="1"/>
<input type="hidden" name="ctrl" value="product"/>
<input type="hidden" name="task" value="updatecart"/>
</form><?php
}
?>
Or do I need a programmer to do as you have suggested above?
Thanks
Please Log in or Create an account to join the conversation.
14 years 10 months ago #29469
by nicolas
Replied by nicolas on topic Re: How to create 2 Different Add To Cart Buttons
Hi,
If you just want to change the text of the button, it can be done without a button template override.
You can change the code :
echo $this->cart->displayButton(JText::_('ADD_TO_CART'),'add',$this->params,$url,$this->ajax,'',$this->row->product_max_per_order,$this->row->product_min_per_order);
in the file "quantity" of the view "product" via the menu Display->Views.
But that still requires some programming skills to load the category of the current product and change the JText::_('ADD_TO_CART') based on the category...
If you just want to change the text of the button, it can be done without a button template override.
You can change the code :
echo $this->cart->displayButton(JText::_('ADD_TO_CART'),'add',$this->params,$url,$this->ajax,'',$this->row->product_max_per_order,$this->row->product_min_per_order);
in the file "quantity" of the view "product" via the menu Display->Views.
But that still requires some programming skills to load the category of the current product and change the JText::_('ADD_TO_CART') based on the category...
Please Log in or Create an account to join the conversation.
14 years 10 months ago #29482
by axyswebs
Replied by axyswebs on topic Re: How to create 2 Different Add To Cart Buttons
Does Hikashop offer a service for this?
Please Log in or Create an account to join the conversation.
14 years 10 months ago #29496
by nicolas
Replied by nicolas on topic Re: How to create 2 Different Add To Cart Buttons
Sure, you can use our contact form to request a quote. We should be able to do that for you for a small fee.
Please Log in or Create an account to join the conversation.
Time to create page: 0.173 seconds