- Posts: 73
- Thank you received: 2
Show Qty box based on Product and/or Category
(Don't want--currently not-show qty box)
(Need to show qty box)
-- HikaShop version -- : 2.2.0
-- Joomla version -- : 2.5.14
-- PHP version -- : 5.4
-- Browser(s) name and version -- : ff 22.0
Are there any plans to be able to have the qty box appear based on product category versus a global setting now? Unless I'm not seeing this option settings correctly, this would really be nice to do as well as see options on the product lisitng page. I use custom fields for now. Right now sadly, I've had to use another shop cart ( ) to show qty where I need it.
Any suggestions will be appreciated.
Thanks
Please Log in or Create an account to join the conversation.
To change the comportment of the quantity input in the listings, you can edit the view "product / add_to_cart_listing", it's possible to add a check on the category to display it the way you want.
If you want to change the display of the input on the product page the view to edit is "product / quantity".
But there is no options for that in the listing menu/modules.
Please Log in or Create an account to join the conversation.
-- Example of product display :
www.fchsptsa.org/how-you-can-help/jag-fund-honor-roll.html
www.fchsptsa.org/how-you-can-help/fall-plant-sale.html (Need to show qty box)
So these pages are category moduules product listing. The first link I need to show qty box but no qty box on the 2nd link (as it appears now).
I'm not sure if I understand your suggestion of editing the view "product / add_to_cart_listing" since I'm not too keen on PHP coding. There was no suggestion provided on how to edit this view. Your assistance would be appreciated.
Thanks
Please Log in or Create an account to join the conversation.
- Posts: 12953
- Thank you received: 1778
If you want to add a quantity box through your product listing I think that you'll probably find your answer there :
You can edit the file listing_img_title of the view product via the menu Display->Views and add the code:
$this->params->set('show_quantity_field', 1);
at the beginning after the first <?php tag.
Hope this will help you.
Please Log in or Create an account to join the conversation.
www.fchsptsa.org/online-shopping-categor...family-sponsors.html
And it plugs in the set amount rather than 1 on this page. Can you make the qty box show zero initially?
then, if you look at this page
www.fchsptsa.org/online-shopping-categories.html
the new line of code appears.
Thanks
Please Log in or Create an account to join the conversation.
This page I don't want QTY box to appear; however on first attachment but need QTY box on the 2nd attachment image (flowers)
thanks
Please Log in or Create an account to join the conversation.
You can try to use this kind of code in the view "product / quantity":
You have to replace 'x', 'y', 'z' by category ids.
Please Log in or Create an account to join the conversation.
Here's my placement of code (partial view of Product/Quantity:
}else{
$end_date = $this->element->main->product_sale_end;
}
if(in_array($this->row->product_category,array('28'))){
$this->params->set('show_quantity_field','1');
}else{
$this->params->set('show_quantity_field','0');
}
if($end_date && $end_date<time()){
?>
<span class="hikashop_product_sale_end">
<?php echo JText::_('ITEM_NOT_SOLD_ANYMORE'); ?>
</span>
I also tried with and without this prior code suggestion in the "listing_img_title"
$this->params->set('show_quantity_field', 1);
No luck
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
product/quantity view
Please Log in or Create an account to join the conversation.
Your code looks globally good. You can use only number and not string, it will unsure you that the check are valid.
Putting some
You can also make some "var_dump" in order to see the content of a variable, it is always useful for checks.
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Note that I changed :
$this->row->product_category
to:
$this->element->category_id
in my code example as $this->row->product_category is not always available on products listings (it depends on how you configure the module/menu.
Please Log in or Create an account to join the conversation.
Attached are my screen shots of my final code as I removed the echo codes.
Please Log in or Create an account to join the conversation.
I've added via Product insert tag product from 3 different categories. I want to only show qty box on the "Donate ANGP Ticket" but not on the other two products. Refer to screen shots to see the product page and the code used in the article.
ptsa.westfieldhs.org/parents/angp-homepa...er-angp-tickets.html
I tried including the last code into the the product/quantity view but no effect.
Is this possible?
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.