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

#   Too many characteristics - stop creation?

##

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

Less More

- Posts: 2
- Thank you received: 1
-
-

13 years 2 months ago [\#119534](#119534) by [whitecommsgroup](/forum/user/25242-whitecommsgroup "View whitecommsgroup's Profile")  *[Too many characteristics - stop creation?](/forum/25-install-update/861252-too-many-characteristics-stop-creation#119534 "Hi  We have several characteristics each with several possible options. Of course when we add these to a product it creates thousands of rows in the database due to the 10x10x10x10 = 10000s  However, we do not need all these rows as products only need one or two of each possible characteristic (i.e. not all 10 possible options for each) so each product would only really need up to 60 rows.  Is it possible to suppress the auto-creation of all these rows in the database?  Thanks Simon")* was created by *[whitecommsgroup](/forum/user/25242-whitecommsgroup "View whitecommsgroup's Profile")*

Hi

We have several characteristics each with several possible options. Of course when we add these to a product it creates thousands of rows in the database due to the 10x10x10x10 = 10000s

However, we do not need all these rows as products only need one or two of each possible characteristic (i.e. not all 10 possible options for each) so each product would only really need up to 60 rows.

Is it possible to suppress the auto-creation of all these rows in the database?

Thanks
Simon

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

- **[Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")**
- [![Mohamed Thelji's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar6861.png)](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")
- [ Offline](/forum/user/6861-mohamed-thelji)

Less More

- Posts: 12953
- Thank you received: 1778
-
-
-

13 years 2 months ago [\#119546](#119546) by [Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")  Replied by *[Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")* on topic *[Too many characteristics - stop creation?](/forum/25-install-update/861252-too-many-characteristics-stop-creation#119546 "Hi  We have several characteristics each with several possible options. Of course when we add these to a product it creates thousands of rows in the database due to the 10x10x10x10 = 10000s  However, we do not need all these rows as products only need one or two of each possible characteristic (i.e. not all 10 possible options for each) so each product would only really need up to 60 rows.  Is it possible to suppress the auto-creation of all these rows in the database?  Thanks Simon")*

Hi Simon,

You'll probably find some information through this [ thread ](http://www.hikashop.com/forum/4-how-to/31240-memory-allocation-too-many-characteristics.html):

> You have too much possibilities. For example, if you have 3 characteristics with 10 values each, that's 10\*10\*10=1000 possibilities. That's already too much.
> You should indeed transform some characteristics into custom fields ( [ www.hikashop.com/en/support/documentatio...p-field-listing.html](http://www.hikashop.com/en/support/documentatio...p-field-listing.html) ) or options ( [ www.hikashop.com/en/support/documentatio...ct-form.html#options](http://www.hikashop.com/en/support/documentatio...ct-form.html#options) ) so that it becomes more manageable for your server.
>
> Characteristics should only be used when you want to change some of the information on the products (the stock, the price, the image, etc). For choices which do not affect any of that custom fields of the table "item" are the way to go.

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

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

Less More

- Posts: 2
- Thank you received: 1
-
-

13 years 2 months ago [\#119551](#119551) by [whitecommsgroup](/forum/user/25242-whitecommsgroup "View whitecommsgroup's Profile")  Replied by *[whitecommsgroup](/forum/user/25242-whitecommsgroup "View whitecommsgroup's Profile")* on topic *[Too many characteristics - stop creation?](/forum/25-install-update/861252-too-many-characteristics-stop-creation#119551 "Hi  We have several characteristics each with several possible options. Of course when we add these to a product it creates thousands of rows in the database due to the 10x10x10x10 = 10000s  However, we do not need all these rows as products only need one or two of each possible characteristic (i.e. not all 10 possible options for each) so each product would only really need up to 60 rows.  Is it possible to suppress the auto-creation of all these rows in the database?  Thanks Simon")*

Hi, I believe I managed to do this by commenting out the following pieces of code in product.php:

First this section:
Code:

if($variants&gt;500){ $this-&gt;database-&gt;setQuery($query.implode(',',$insert).';'); $this-&gt;database-&gt;query(); $this-&gt;database-&gt;setQuery('SELECT product_id,product_code FROM '.hikashop_table('product').' WHERE product_code IN ('.implode(',',$db_codes).')'); $objs = $this-&gt;database-&gt;loadObjectList(); foreach($objs as $obj){ foreach($codes[$obj-&gt;product_code] as $k){ $newVariants[]= '('.(int)$k.','.$obj-&gt;product_id.',0)'; } } if(!empty($newVariants)){ $this-&gt;database-&gt;setQuery('INSERT IGNORE INTO '.hikashop_table('variant').' (variant_characteristic_id,variant_product_id,ordering) VALUES '.implode(',',$newVariants)); $this-&gt;database-&gt;query(); } $codes=array(); $variants=0; $insert=array(); $db_codes=array(); $newVariants =array();

and this section of code:
Code:

if(!empty($insert)){ $this-&gt;database-&gt;setQuery($query.implode(',',$insert).';'); $this-&gt;database-&gt;query(); $this-&gt;database-&gt;setQuery('SELECT product_id,product_code FROM '.hikashop_table('product').' WHERE product_code IN ('.implode(',',$db_codes).')'); $objs = $this-&gt;database-&gt;loadObjectList(); foreach($objs as $obj){ foreach($codes[$obj-&gt;product_code] as $k){ $newVariants[]= '('.(int)$k.','.$obj-&gt;product_id.',0)'; } } if(!empty($newVariants)){ $this-&gt;database-&gt;setQuery('INSERT IGNORE INTO '.hikashop_table('variant').' (variant_characteristic_id,variant_product_id,ordering) VALUES '.implode(',',$newVariants)); $this-&gt;database-&gt;query(); } }

The following user(s) said Thank You: [nicolas](/forum/user/63-nicolas "View nicolas's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI1LWluc3RhbGwtdXBkYXRlLzg2MTI1Mi10b28tbWFueS1jaGFyYWN0ZXJpc3RpY3Mtc3RvcC1jcmVhdGlvbj90bXBsPW1hcmtkb3du) 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.130 seconds

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

[](#top)
