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

#   Display inconsistencies in back-end for variants

##

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

Less More

- Posts: 113
- Thank you received: 18
-
-

10 years 2 months ago [\#248606](#248606) by [csymmonds](/forum/user/9149-csymmonds "View csymmonds's Profile")  *[Display inconsistencies in back-end for variants](/forum/32-content-creation/886176-display-inconsistencies-in-back-end-for-variants#248606 "-- HikaShop version -- : 2.6.3 -- Joomla version -- : 3.5.1 -- PHP version -- : 5.6.24 -- Browser(s) name and version -- : Firefox 48.02  The order of pricing levels appears to be inconsistent. On the product page, entering multiple prices works well and the price levels are consistently displayed in the order entered. When entering price levels for variants, the order changes once the record is saved. This appears to happen consistently on products with 2 or more characteristics.  The order of variants themselves changes as well when the record is saved - even records with a single characteristic.  When maintenance is needed to a product of this type, it's more difficult than it should be as records are changing order during editing - it's like trying to hit a moving target.  When editing multiple products, some simple, some with variants, the behavior seems to vary.")* was created by *[csymmonds](/forum/user/9149-csymmonds "View csymmonds's Profile")*

-- HikaShop version -- : 2.6.3
-- Joomla version -- : 3.5.1
-- PHP version -- : 5.6.24
-- Browser(s) name and version -- : Firefox 48.02

The order of pricing levels appears to be inconsistent. On the product page, entering multiple prices works well and the price levels are consistently displayed in the order entered. When entering price levels for variants, the order changes once the record is saved. This appears to happen consistently on products with 2 or more characteristics.

The order of variants themselves changes as well when the record is saved - even records with a single characteristic.

When maintenance is needed to a product of this type, it's more difficult than it should be as records are changing order during editing - it's like trying to hit a moving target.

When editing multiple products, some simple, some with variants, the behavior seems to vary.

- [ ![ordering.png](/forum/attachment/33220) ](/forum/attachment/33220 "ordering.png") [ ](/forum/attachment/33220?download=1 "ordering.png")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2NvbnRlbnQtY3JlYXRpb24vODg2MTc2LWRpc3BsYXktaW5jb25zaXN0ZW5jaWVzLWluLWJhY2stZW5kLWZvci12YXJpYW50cz90bXBsPW1hcmtkb3du) 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")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86320
- Thank you received: 14276
-
-

10 years 2 months ago [\#248673](#248673) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Display inconsistencies in back-end for variants](/forum/32-content-creation/886176-display-inconsistencies-in-back-end-for-variants#248673 "-- HikaShop version -- : 2.6.3 -- Joomla version -- : 3.5.1 -- PHP version -- : 5.6.24 -- Browser(s) name and version -- : Firefox 48.02  The order of pricing levels appears to be inconsistent. On the product page, entering multiple prices works well and the price levels are consistently displayed in the order entered. When entering price levels for variants, the order changes once the record is saved. This appears to happen consistently on products with 2 or more characteristics.  The order of variants themselves changes as well when the record is saved - even records with a single characteristic.  When maintenance is needed to a product of this type, it's more difficult than it should be as records are changing order during editing - it's like trying to hit a moving target.  When editing multiple products, some simple, some with variants, the behavior seems to vary.")*

Hi,

I've done some tests but I don't see the issue on my end.
I can create the variants and the prices in the variants and save them and they come back in the same order.
You say that it appears only in some cases ?
Could you do more tests to figure out what really makes the prices or variants dont respect the same order ?

Regarding the variants, they are automatically ordered based on the ordering of the characteristics (on the characteristics listing) and the ordering of the values (in the characteristics) unless you changed the "characteristics values ordering" setting of the HikaShop configuration.

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

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

Less More

- Posts: 113
- Thank you received: 18
-
-

10 years 2 months ago [\#248693](#248693) by [csymmonds](/forum/user/9149-csymmonds "View csymmonds's Profile")  Replied by *[csymmonds](/forum/user/9149-csymmonds "View csymmonds's Profile")* on topic *[Display inconsistencies in back-end for variants](/forum/32-content-creation/886176-display-inconsistencies-in-back-end-for-variants#248693 "-- HikaShop version -- : 2.6.3 -- Joomla version -- : 3.5.1 -- PHP version -- : 5.6.24 -- Browser(s) name and version -- : Firefox 48.02  The order of pricing levels appears to be inconsistent. On the product page, entering multiple prices works well and the price levels are consistently displayed in the order entered. When entering price levels for variants, the order changes once the record is saved. This appears to happen consistently on products with 2 or more characteristics.  The order of variants themselves changes as well when the record is saved - even records with a single characteristic.  When maintenance is needed to a product of this type, it's more difficult than it should be as records are changing order during editing - it's like trying to hit a moving target.  When editing multiple products, some simple, some with variants, the behavior seems to vary.")*

I'm able to recreate the described issue fairly easily.
I keep a clean site for testing purposes, fresh Joomla 3.62 and Hikashop 2.6.3 with sample Hikashop data installed.
Nothing else installed or modified, about the only things I've done is enable a shipping method and payment method, maybe changed currency from EUR to USD in a few places.

To recreate:
Edit the sample data's Brown Shoes product, add characteristics for Color and Shoe Size, add each combination as variants, save and close the record. Open the product again, view Variants tab and note the order. Make an edit to any of the variants and save the variant using the "Save" button beneath the list of variants. The order of the variant records will change when saved.

The issue I'm seeing with prices changing order isn't as readily recreated, but there are times when the order of presentation makes no sense to me at all: not in the order entered, not ordered by quantity, not ordered by price as shown in the attached.

- [ ![shotprice1.png](/forum/attachment/33244) ](/forum/attachment/33244 "shotprice1.png") [ ](/forum/attachment/33244?download=1 "shotprice1.png")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2NvbnRlbnQtY3JlYXRpb24vODg2MTc2LWRpc3BsYXktaW5jb25zaXN0ZW5jaWVzLWluLWJhY2stZW5kLWZvci12YXJpYW50cz90bXBsPW1hcmtkb3du) 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")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86320
- Thank you received: 14276
-
-

10 years 2 months ago [\#248749](#248749) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Display inconsistencies in back-end for variants](/forum/32-content-creation/886176-display-inconsistencies-in-back-end-for-variants#248749 "-- HikaShop version -- : 2.6.3 -- Joomla version -- : 3.5.1 -- PHP version -- : 5.6.24 -- Browser(s) name and version -- : Firefox 48.02  The order of pricing levels appears to be inconsistent. On the product page, entering multiple prices works well and the price levels are consistently displayed in the order entered. When entering price levels for variants, the order changes once the record is saved. This appears to happen consistently on products with 2 or more characteristics.  The order of variants themselves changes as well when the record is saved - even records with a single characteristic.  When maintenance is needed to a product of this type, it's more difficult than it should be as records are changing order during editing - it's like trying to hit a moving target.  When editing multiple products, some simple, some with variants, the behavior seems to vary.")*

Hi,

The only reason I'm seeing a different order with the variants with your example is because there is no ordering set for the values in the color characteristic. Define an ordering and the ordering won't be random.
So that's what I was talking in my previous message.
If you set the ordering properly, then the variants should always be in the same order. Isn't that the case for you too ?

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

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

Less More

- Posts: 113
- Thank you received: 18
-
-

10 years 2 months ago [\#248757](#248757) by [csymmonds](/forum/user/9149-csymmonds "View csymmonds's Profile")  Replied by *[csymmonds](/forum/user/9149-csymmonds "View csymmonds's Profile")* on topic *[Display inconsistencies in back-end for variants](/forum/32-content-creation/886176-display-inconsistencies-in-back-end-for-variants#248757 "-- HikaShop version -- : 2.6.3 -- Joomla version -- : 3.5.1 -- PHP version -- : 5.6.24 -- Browser(s) name and version -- : Firefox 48.02  The order of pricing levels appears to be inconsistent. On the product page, entering multiple prices works well and the price levels are consistently displayed in the order entered. When entering price levels for variants, the order changes once the record is saved. This appears to happen consistently on products with 2 or more characteristics.  The order of variants themselves changes as well when the record is saved - even records with a single characteristic.  When maintenance is needed to a product of this type, it's more difficult than it should be as records are changing order during editing - it's like trying to hit a moving target.  When editing multiple products, some simple, some with variants, the behavior seems to vary.")*

That is not the case.
I had tested with an order set on color characteristics as well before posting the reply.

The order of variants displayed after saving changes.
Detail on characteristic setup shown below, as well as the variant order on initial display and after saving a variant record.

[ ![ordering2.png](/forum/attachment/33258) ](/forum/attachment/33258 "ordering2.png")

- [ ![ordering2.png](/forum/attachment/33258) ](/forum/attachment/33258 "ordering2.png") [ ](/forum/attachment/33258?download=1 "ordering2.png")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2NvbnRlbnQtY3JlYXRpb24vODg2MTc2LWRpc3BsYXktaW5jb25zaXN0ZW5jaWVzLWluLWJhY2stZW5kLWZvci12YXJpYW50cz90bXBsPW1hcmtkb3du) 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")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86320
- Thank you received: 14276
-
-

10 years 2 months ago [\#248766](#248766) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Display inconsistencies in back-end for variants](/forum/32-content-creation/886176-display-inconsistencies-in-back-end-for-variants#248766 "-- HikaShop version -- : 2.6.3 -- Joomla version -- : 3.5.1 -- PHP version -- : 5.6.24 -- Browser(s) name and version -- : Firefox 48.02  The order of pricing levels appears to be inconsistent. On the product page, entering multiple prices works well and the price levels are consistently displayed in the order entered. When entering price levels for variants, the order changes once the record is saved. This appears to happen consistently on products with 2 or more characteristics.  The order of variants themselves changes as well when the record is saved - even records with a single characteristic.  When maintenance is needed to a product of this type, it's more difficult than it should be as records are changing order during editing - it's like trying to hit a moving target.  When editing multiple products, some simple, some with variants, the behavior seems to vary.")*

Hi,

Thanks for the additional details. I was able to reproduce the issue consistantly and fix it.
Change the code: Code:

foreach($variant_data as $d) { $ppid = (int)$d-&gt;variant_product_id; if(isset($product-&gt;variants[$ppid])) { if(empty($product-&gt;variants[$ppid]-&gt;characteristics)) $product-&gt;variants[$ppid]-&gt;characteristics = array(); $pcid = (int)$product-&gt;characteristics[$d-&gt;characteristic_parent_id]-&gt;characteristic_id; $value = new stdClass(); $value-&gt;id = $d-&gt;characteristic_id; $value-&gt;value = $d-&gt;characteristic_value; $product-&gt;variants[$ppid]-&gt;characteristics[$pcid] = $value; } }

to: Code:

if(!empty($product-&gt;characteristics)) { $i = 0; foreach($product-&gt;characteristics as &amp;$c) { $c-&gt;sort_value = $i++; } unset($c); } foreach($variant_data as $d) { $ppid = (int)$d-&gt;variant_product_id; if(!isset($product-&gt;variants[$ppid])) continue; if(empty($product-&gt;variants[$ppid]-&gt;characteristics)) $product-&gt;variants[$ppid]-&gt;characteristics = array(); $pcid = (int)$product-&gt;characteristics[$d-&gt;characteristic_parent_id]-&gt;characteristic_id; $value = new stdClass(); $value-&gt;id = $d-&gt;characteristic_id; $value-&gt;value = $d-&gt;characteristic_value; $product-&gt;variants[$ppid]-&gt;characteristics[$pcid] = $value; if(!isset($product-&gt;variants[$ppid]-&gt;sorting_value)) $product-&gt;variants[$ppid]-&gt;sorting_value = array(); $i = (int)$product-&gt;characteristics[ (int)$d-&gt;characteristic_parent_id ]-&gt;sort_value; $product-&gt;variants[$ppid]-&gt;sorting_value[ $i ] = (int)$d-&gt;characteristic_ordering; } usort($product-&gt;variants, array(&amp;$this, 'variantSortingCallback'));

in administrator/components/com_hikashop/views/product/view.html.php and that will fix the problem.

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

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

Less More

- Posts: 113
- Thank you received: 18
-
-

10 years 2 months ago [\#248795](#248795) by [csymmonds](/forum/user/9149-csymmonds "View csymmonds's Profile")  Replied by *[csymmonds](/forum/user/9149-csymmonds "View csymmonds's Profile")* on topic *[Display inconsistencies in back-end for variants](/forum/32-content-creation/886176-display-inconsistencies-in-back-end-for-variants#248795 "-- HikaShop version -- : 2.6.3 -- Joomla version -- : 3.5.1 -- PHP version -- : 5.6.24 -- Browser(s) name and version -- : Firefox 48.02  The order of pricing levels appears to be inconsistent. On the product page, entering multiple prices works well and the price levels are consistently displayed in the order entered. When entering price levels for variants, the order changes once the record is saved. This appears to happen consistently on products with 2 or more characteristics.  The order of variants themselves changes as well when the record is saved - even records with a single characteristic.  When maintenance is needed to a product of this type, it's more difficult than it should be as records are changing order during editing - it's like trying to hit a moving target.  When editing multiple products, some simple, some with variants, the behavior seems to vary.")*

Perfect, thanks.
This fixes the variants changing order.

I'll revisit pricing issues if I see it again and can document a means to recreate.

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

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

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

[](#top)
