[SOLVED]Shipping calculation problem with variants

  • Posts: 332
  • Thank you received: 6
10 years 4 months ago #163570

-- url of the page with the problem -- : CarterRabbitBlanks.com
-- HikaShop version -- : HikaShop Business: 2.3.1
-- Joomla version -- : Joomla! 2.5.22 Stable
-- PHP version -- :5.3.28
-- Browser(s) name and version -- : Firefox 29.0.1
-- Error-message(debug-mod must be tuned on) -- : No Error message

As there is no 'New Feature Request' forum, I would like to make it here.

I just found out that if you add a 'Quantity' to a variant for inventory control, the Main Product Record shipping settings are disregarded and you get a 'No Shipping Method Found' error message. I have tested this and it is how it works. I set the 'Warehouse' and weight on the variant records and, viola, we got a proper shipping charge.

This is problematic due to the work involved with variants. Logic would dictate that if you have added a quantity to a variant and there is 'no' shipping information entered on the variant, that the order process should use the 'main product' shipping information to determine shipping. Let's say you have 10 sizes, 5 colors and 4 textures on a dress. You want to keep inventory control on each variant. Fine! However, all of the dresses are coming from a single Warehouse or has a single shipping method. If you set it up in the main product record, it is disregarded now that a 'quantity' has been added to each variant. Now you have to updated 200 variants (10x5x4) to add the 'same' shipping information that is in the 'main product' record to each individual variant. This is 'unacceptable' as it creates a lot of unnecessary work to maintain shipping.

Now if the 'main product' shipping is suppose to be used, why didn't it work on my clients site and I did test it multiple times. If you have to put the shipping info on each individual variant when a quantity is added, please add this to your 'to-do' list to use the 'main product' shipping information if 'no' shipping information is marked in a variant.

Last edit: 10 years 2 months ago by LukeDouglas.

Please Log in or Create an account to join the conversation.

  • Posts: 12953
  • Thank you received: 1778
10 years 4 months ago #163606

Hello,
Firstly, can you show me through some screenshots how did you configured the shipping method that is supposed to be shown through the checkout workflow (even its restriction options), and how did you configured the products and variants that are on the cart through the checkout workflow ?

Please Log in or Create an account to join the conversation.

  • Posts: 332
  • Thank you received: 6
10 years 4 months ago #163708

Mohamed,

Here are screenshots with brief description for one product "Irregular Cut Bib Collared Dress" size "6Y".

SHIPPING LIST:



SHIPPING RECORD THAT IS USED IN THESE EXAMPLES:



MAIN PRODUCT RECORD:



VARIANT RECORD WITHOUT WAREHOUSE SETTING:



CHECKOUT WITHOUT WAREHOUSE SETTING:



VARIANT RECORD WITH WAREHOUSE SETTING:



CHECKOUT WITH WAREHOUSE SETTING:



What this shows is that if you are using 'warehouse' settings for different shipping methods and the variant record does not have the warehouse setting, it will not find a shipping charge even though the 'warehouse' is indicated in the main product record. If you set the 'warehouse' setting in the variant record, it charges shipping.

My point is that if a variant does not have a setting for any field in the variant record that has the same setting in the main product record, then HikaShop should see what the 'default' setting is in the main product record and use that to make it's calculations. Now my gut tells me that most of these are probably being done but, from testing, it is not working for 'Warehouse'.

I hope this gives you an indication of what is happening and you can fix this problem.

Please Log in or Create an account to join the conversation.

  • Posts: 12953
  • Thank you received: 1778
10 years 4 months ago #163793

Hello,
Can you unset the "weight"/"Warehouse" options of your variants and try it again ? In your case, your shipping methods are using your variant dimensions which are 1 lb - 0x0x0m.

Please Log in or Create an account to join the conversation.

  • Posts: 332
  • Thank you received: 6
10 years 4 months ago #163859

Mohamed,

Variant without warehouse or weight



Checkout without warehouse or weight settings



Reset variant back to warehouse but without weight



Checkout with warehouse but without weight



The main product page still has 'Price' warehouse and weight set to 1 lb.

Last edit: 10 years 4 months ago by LukeDouglas.

Please Log in or Create an account to join the conversation.

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
10 years 4 months ago #163863

Hi,

Thanks for the details.
Can you please update (manually) your HikaShop to the latest version ? (2.3.2)
www.hikashop.com/support/support/documen...ashop-changelog.html

We fixed some things in the shipping/warehouse system like

The warehouse selection of the main product is not passed automatically to the variants if the no warehouse is selected in the variants

It could be the same problem than yours.
If not, don't hesitate to tell us and we will see to reproduce it in our local websites.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 332
  • Thank you received: 6
10 years 4 months ago #163899

Jerome,

I updated to version 2.3.2. I won't post the screenshots as it's identical to the ones above with the except of the drop-down on the variants for 'virtual' goods and 'shippable' goods. It made no difference. When the warehouse is not set in the variant, we get no shipping method found on checkout for that item. When we go back and set it to a warehouse, then shipping is calculated properly.

Any other suggestions?

Please Log in or Create an account to join the conversation.

  • Posts: 12953
  • Thank you received: 1778
10 years 4 months ago #163900

Hello,
I just tested it and it worked fine for me, can you give me a temporary access to your back-end through a private message, so that I can directly test it through your website ?
Thanks.

Please Log in or Create an account to join the conversation.

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
10 years 4 months ago #164028

Hi,

I reproduced your problem.
Can you please edit the file "administrator/components/com_hikashop/classes/shipping.php" and replace

		$shipping_groups[0] = $warehouse;

		if(!empty($order->products)){
			foreach($order->products as &$product) {
				if(@$product->cart_product_quantity <= 0)
					continue;
By
		$shipping_groups[0] = $warehouse;

		if(!empty($order->products)){
			foreach($order->products as &$product) {
				if(@$product->cart_product_quantity <= 0)
					continue;

				if(empty($product->product_warehouse_id) && !empty($product->cart_product_parent_id)) {
					foreach($order->products as $l => $elem){
						if($elem->cart_product_id == $product->cart_product_parent_id) {
							$product->product_warehouse_id = $elem->product_warehouse_id;
							break;
						}
					}
				}
It should fix your problem.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
Last edit: 10 years 4 months ago by Jerome. Reason: code fix

Please Log in or Create an account to join the conversation.

  • Posts: 332
  • Thank you received: 6
10 years 4 months ago #164040

Jerome,

Will this change be implemented into the next version of HikaShop Business?

Although I try NOT to do it, I don't mind making changes to core files but only if those changes are going to be included in future updates. I'm not going to keep track of changes I make so I can continually edit future versions of 3rd party applications.

Please Log in or Create an account to join the conversation.

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
10 years 4 months ago #164041

Hi,

If you validate my patch, it will be included in the next build of HikaShop.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 332
  • Thank you received: 6
10 years 4 months ago #164049

Jerome,

OK, so how do I validate your patch? I've never been told that from support.

Please Log in or Create an account to join the conversation.

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
10 years 4 months ago #164051

Hi,

First, you need to edit the file and apply the modification.
For sure, the best is to make a copy of the file in order to restore it, if necessary.

To validate the patch, you just have to test it and confirm that it solve your problem.
If so, I will commit the patch into HikaShop for the next builds.

Even if I am a moderator here, I am not really in the HikaShop support team but I am in the HikaShop core team.
The problem you have is a bug for me, so the patch must be and will be available for everyone.
HikaShop has been made to allow user to override view and customize the display ; so when we ask someone to edit a core file, our goal is to include this modification in the HikaShop core. Otherwise we use plugins or overrides.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 332
  • Thank you received: 6
10 years 4 months ago #164055

Jerome,

I'll do this tomorrow, thoroughly test, get screenshots and report back here. Have a great day!

Please Log in or Create an account to join the conversation.

  • Posts: 332
  • Thank you received: 6
10 years 4 months ago #164221

Jerome,

I made the changes to the shipping.php file, removed the warehouse setting from one of the variants, saved and did a test purchase with that variant. I got 'No shipping method found'. I restored the warehouse setting for the variant record back to 'Price Warehouse', did a test purchased and the shipping calculated properly.

Your fix did not work. I have attached the edited shipping.php file.

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
10 years 4 months ago #164254

Hi,

So I will require a FTP access in order to add some debug traces and fix the problem directly in your website.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
10 years 4 months ago #164574

Hi,

The problem is now fix in your website.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 332
  • Thank you received: 6
10 years 4 months ago #164587

Jerome,

I did a test and it does appear you have fixed the problem. Now can you explain exactly what you did and if any future updates of HikaShop Business will overwrite the changes you made?

Please Log in or Create an account to join the conversation.

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
10 years 4 months ago #164629

Hi,

I use the code that I provide you in the previous post.
There were a typo problem when I submit the post but I fixed it just after.
So the code now in the post 164028 is now good.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 332
  • Thank you received: 6
10 years 4 months ago #164652

Will these changes be in upcoming releases of Business HikaShop or will future updates of Business HikaShop overwrite the changes you made?

Please Log in or Create an account to join the conversation.

Time to create page: 0.101 seconds
Powered by Kunena Forum