[Skip to main content](#vessel-content)

#   Customizable way to show products

##

- **[wideservices](/forum/user/29752-wideservices "View wideservices's Profile")**
- [![wideservices's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/29752-wideservices "View wideservices's Profile") Topic Author
- [ Offline](/forum/user/29752-wideservices)

Less More

- Posts: 95
- Thank you received: 1
-
-

11 years 1 month ago [\#216629](#216629) by [wideservices](/forum/user/29752-wideservices "View wideservices's Profile")  *[Customizable way to show products](/forum/26-product-category-display/879727-customizable-way-to-show-products#216629 "-- HikaShop version -- : 2.5.0 -- Joomla version -- : 3.4.4 -- PHP version -- : 5.5.12  hi, i am interested in a customized way of selecting products and proceeding to checkout. I will have a group of products tagged &quot;1st week&quot;.Another group with tag &quot;2nd week&quot; and another with tag &quot;1st and 2nd week&quot; When a user select a product from &quot;1st week&quot; he must not be able to select a product from the group &quot;1st and 2nd week&quot;. Similarly when he selects a product from &quot;1st and 2nd week&quot; he must not be able to select a product from any other group. So i want to &quot;enable&quot; conditional product selection. When a user chooses &quot;this&quot; product then he cannot choose &quot;that&quot; product. Is it possible to do sth like that even with a completely &quot;reworked&quot; view. And lastly i want whatever product or how many products he selects the order total to be a fixed number. 1 product -&gt; 10$ 2products -&gt;10$ ..... -&gt;10$")* was created by *[wideservices](/forum/user/29752-wideservices "View wideservices's Profile")*

-- HikaShop version -- : 2.5.0
-- Joomla version -- : 3.4.4
-- PHP version -- : 5.5.12

hi,
i am interested in a customized way of selecting products and proceeding to checkout.
I will have a group of products tagged "1st week".Another group with tag "2nd week" and another with tag "1st and 2nd week"
When a user select a product from "1st week" he must not be able to select a product from the group "1st and 2nd week". Similarly when he selects a product from "1st and 2nd week" he must not be able to select a product from any other group. So i want to "enable" conditional product selection. When a user chooses "this" product then he cannot choose "that" product. Is it possible to do sth like that even with a completely "reworked" view.
And lastly i want whatever product or how many products he selects the order total to be a fixed number.
1 product -&gt; 10$
2products -&gt;10$
..... -&gt;10$

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI2LXByb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS84Nzk3MjctY3VzdG9taXphYmxlLXdheS10by1zaG93LXByb2R1Y3RzP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86584
- Thank you received: 14325
-
-

11 years 1 month ago [\#216690](#216690) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Customizable way to show products](/forum/26-product-category-display/879727-customizable-way-to-show-products#216690 "-- HikaShop version -- : 2.5.0 -- Joomla version -- : 3.4.4 -- PHP version -- : 5.5.12  hi, i am interested in a customized way of selecting products and proceeding to checkout. I will have a group of products tagged &quot;1st week&quot;.Another group with tag &quot;2nd week&quot; and another with tag &quot;1st and 2nd week&quot; When a user select a product from &quot;1st week&quot; he must not be able to select a product from the group &quot;1st and 2nd week&quot;. Similarly when he selects a product from &quot;1st and 2nd week&quot; he must not be able to select a product from any other group. So i want to &quot;enable&quot; conditional product selection. When a user chooses &quot;this&quot; product then he cannot choose &quot;that&quot; product. Is it possible to do sth like that even with a completely &quot;reworked&quot; view. And lastly i want whatever product or how many products he selects the order total to be a fixed number. 1 product -&gt; 10$ 2products -&gt;10$ ..... -&gt;10$")*

Hi,

1. I don't see a way to do that with the options available by default in HikaShop. So it will require customizing the "quantity" file of the view "product" via the menu Display&gt;Views to add custom code in order to do that. you'll want to load the products from the current cart, and if there are products in cart preventing you from adding the current product displayed to the cart, remove the display of the add to cart button.

2. In that case, you can set the price of all the products to 0, change the "free" text to something else in order to suits your needs with a translation override:
[ hikashop.com/download/languages.html#modify](https://hikashop.com/download/languages.html#modify)
And then, you can use that plugin [ www.hikashop.com/forum/taxes/873285-fix-tax-import.html#190511](http://www.hikashop.com/forum/taxes/873285-fix-tax-import.html#190511) in order to define that $10 amount.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI2LXByb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS84Nzk3MjctY3VzdG9taXphYmxlLXdheS10by1zaG93LXByb2R1Y3RzP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[wideservices](/forum/user/29752-wideservices "View wideservices's Profile")**
- [![wideservices's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/29752-wideservices "View wideservices's Profile") Topic Author
- [ Offline](/forum/user/29752-wideservices)

Less More

- Posts: 95
- Thank you received: 1
-
-

11 years 1 month ago [\#216747](#216747) by [wideservices](/forum/user/29752-wideservices "View wideservices's Profile")  Replied by *[wideservices](/forum/user/29752-wideservices "View wideservices's Profile")* on topic *[Customizable way to show products](/forum/26-product-category-display/879727-customizable-way-to-show-products#216747 "-- HikaShop version -- : 2.5.0 -- Joomla version -- : 3.4.4 -- PHP version -- : 5.5.12  hi, i am interested in a customized way of selecting products and proceeding to checkout. I will have a group of products tagged &quot;1st week&quot;.Another group with tag &quot;2nd week&quot; and another with tag &quot;1st and 2nd week&quot; When a user select a product from &quot;1st week&quot; he must not be able to select a product from the group &quot;1st and 2nd week&quot;. Similarly when he selects a product from &quot;1st and 2nd week&quot; he must not be able to select a product from any other group. So i want to &quot;enable&quot; conditional product selection. When a user chooses &quot;this&quot; product then he cannot choose &quot;that&quot; product. Is it possible to do sth like that even with a completely &quot;reworked&quot; view. And lastly i want whatever product or how many products he selects the order total to be a fixed number. 1 product -&gt; 10$ 2products -&gt;10$ ..... -&gt;10$")*

Thank you for your reply Nicolas,
I have managed to write some code that gives the functionality that i want and added the code to quantity.php as you instructed.
Code:

global $Itemid; $database = JFactory::getDBO(); $url_itemid = ''; $app = JFactory::getApplication(); $class = hikashop_get('class.cart'); $cart_type = 'cart'; $cart_id =$app-&gt;getUserState( HIKASHOP_COMPONENT.'.'.$cart_type.'_id', 0, 'int' ); $class-&gt;get($cart_id,true,$cart_type); $full = $class-&gt;loadFullCart(true,true,true); $rows = $full-&gt;products; $cat= array(); $cart_cat = array(); $found=false; foreach ($this-&gt;categories as $category){ array_push($cat, $category-&gt;category_id); //categories of the current product } var_dump($this-&gt;categories); foreach($rows as $row){ $query = 'SELECT b.category_id FROM '.hikashop_table('product_category').' AS a LEFT JOIN '.hikashop_table('category').' AS b ON a.category_id = b.category_id WHERE a.product_id = '.(int)$row-&gt;product_id.' ORDER BY a.product_category_id ASC'; $database-&gt;setQuery($query); $categories = $database-&gt;loadObjectList(); $this-&gt;assignRef('categories',$categories);//categories of the products that are already in cart foreach ($categories as $category){ if (in_array($category-&gt;category_id, $cat)){ //if there is a product in the cart with same category as the current product $found=true; break; } } if ($found){ break; } } if ($found){ echo 'hide add to cart'; } else{ echo ' show add to cart'; }

I have created categories for my products and at version 1 of the code i check the categories of the products at the cart and if the current product has the same category i hide the add to cart button.

I have 2 problems.
First one is that when i add a product to the cart from a product listing and then i press continue shopping(thats what i want the user to able to do) the page does not refresh so my code is not run.

Secondly the var_dump($this-&gt;categories); always return null for the first product in product listing but if i enter the product view of the said product it displays my array correctly. It is always null for the first product in product listing. Where is the error in my logic?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI2LXByb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS84Nzk3MjctY3VzdG9taXphYmxlLXdheS10by1zaG93LXByb2R1Y3RzP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86584
- Thank you received: 14325
-
-

11 years 1 month ago [\#216845](#216845) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Customizable way to show products](/forum/26-product-category-display/879727-customizable-way-to-show-products#216845 "-- HikaShop version -- : 2.5.0 -- Joomla version -- : 3.4.4 -- PHP version -- : 5.5.12  hi, i am interested in a customized way of selecting products and proceeding to checkout. I will have a group of products tagged &quot;1st week&quot;.Another group with tag &quot;2nd week&quot; and another with tag &quot;1st and 2nd week&quot; When a user select a product from &quot;1st week&quot; he must not be able to select a product from the group &quot;1st and 2nd week&quot;. Similarly when he selects a product from &quot;1st and 2nd week&quot; he must not be able to select a product from any other group. So i want to &quot;enable&quot; conditional product selection. When a user chooses &quot;this&quot; product then he cannot choose &quot;that&quot; product. Is it possible to do sth like that even with a completely &quot;reworked&quot; view. And lastly i want whatever product or how many products he selects the order total to be a fixed number. 1 product -&gt; 10$ 2products -&gt;10$ ..... -&gt;10$")*

Hi,

1. It probably means that you have the "Use AJAX when possible for add to cart buttons" setting of the HikaShop configuration activated. Turn it off and the page will refresh.

2. $this-&gt;categories is not defined on listings. It's only defined on the product page.
For the category of the current listing, its data is available in $this-&gt;element

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI2LXByb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS84Nzk3MjctY3VzdG9taXphYmxlLXdheS10by1zaG93LXByb2R1Y3RzP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.065 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
