Forums / Bug Reports / [Done 1.3.8] Products priced by attribute calculates wrong shipping

[Done 1.3.8] Products priced by attribute calculates wrong shipping

Locked

Views: 3,686

Results 1 to 20 of 20
This thread is locked. New replies are disabled.
15 Feb 2007, 6:54 PM
#1
ktnaturals avatar

ktnaturals

Zen Follower

Join Date:
Dec 2006
Location:
Ohio
Posts:
196
Plugin Contributions:
0

[Done 1.3.8] Products priced by attribute calculates wrong shipping

I upgraded from 1.3.6 to 1.3.7. I'm not sure if it worked correctly in 1.3.6... After days of testing, I finally figured out what was happening w/ my Gift Certificates...

When you have a product (virtual or not) priced by attributes with Always Free Shipping, the shipping is calculated wrong - it adds the cost of the product to determine shipping (in other words, there's no free shipping). I'm using table rate shipping.

15 Feb 2007, 7:03 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: [Done 1.3.8] Products priced by attribute calculates wrong shipping

The shipping modules are setup to know that a product is Free Shipping and not to include them ...

If you do not have your Product setup correctly or your tables rates setup correctly you will not get the proper calculations ...

Have you an URL and the Products to you putting together in an order where the shipping is not correct that we can look at?

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

15 Feb 2007, 7:08 PM
#3
ktnaturals avatar

ktnaturals

Zen Follower

Join Date:
Dec 2006
Location:
Ohio
Posts:
196
Plugin Contributions:
0

Re: [Done 1.3.8] Products priced by attribute calculates wrong shipping

I set up several test products:

http://www.ktnaturals.com/catalog/index.php?main_page=index&cPath=15

Add a Test Prod ($0.01 will add $2 to shipping). Then add "Test prod free shipping attributes" at least $10. It will calculate $3.50 shipping. It's still supposed to be $2.

15 Feb 2007, 7:22 PM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: [Done 1.3.8] Products priced by attribute calculates wrong shipping

New Cart I have added:
1 products_id 91 Test Free shipping
Shipping Free

New Cart I have added:
1 products_id 90 Test Prod
Shipping $2.00

New Cart I have added:
2 products_id 91 Test Free shipping
1 products_id 90 Test Prod
Shipping $2.00

New Cart I have added:
2 products_id 93 Test prod free shipping attributes
Shipping Free

New Cart I have added:
3 products_id 93 Test prod free shipping attributes
Shipping Free

New Cart I have added:
3 products_id 93 Test prod free shipping attributes
1 products_id 90 Test Prod
Shipping $3.50

What are your settings for this shipping module?

What happens if you go to Modules ... Shipping ... click on Table ... click on Edit ... write down your settings ... Click Update ... Click Remove ... Click Install ... Reconfigure ... Click Update ...

What are all of the settings for your Table shipping ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

15 Feb 2007, 7:24 PM
#5
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: [Done 1.3.8] Products priced by attribute calculates wrong shipping

NOTE: Make sure that you are not marking things both Virual and Always Free Shipping ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

15 Feb 2007, 7:27 PM
#6
ktnaturals avatar

ktnaturals

Zen Follower

Join Date:
Dec 2006
Location:
Ohio
Posts:
196
Plugin Contributions:
0

Re: [Done 1.3.8] Products priced by attribute calculates wrong shipping

I have Table Rate set to:

9.99:2.00,19.99:3.50,34.99:4.50,49.99:5.50,10000:0.00

so anything over $50 is free shipping...

I have removed and installed this module several times...

As you can see from my test products, there are products that are virtual that don't have free shipping checked.

15 Feb 2007, 7:45 PM
#7
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: [Done 1.3.8] Products priced by attribute calculates wrong shipping

I think I need a peek in your Admin at how you have these setup ... as this isn't making a lot of sense ...

If that is not a problem ... then you may PM me with an URL and login to it ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

16 Feb 2007, 1:46 AM
#8
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: [Done 1.3.8] Products priced by attribute calculates wrong shipping

Gads I hate shipping bugs tied into attributes tied into free shipping ... :eek:

But I think I have the solution ... :smartass:

Edit the file:
/includes/classes/shopping_cart.php

Find the line around 689 starting with:

          // bottom total

And replace all of the lines from there to the last line around 721 that starts with:

            } // eof: attribute price

And replace that whole section with:

          // bottom total
          //            if ($attribute_price->fields['product_attribute_is_free']) {
          if ($attribute_price->fields['product_attribute_is_free'] == '1' and zen_get_products_price_is_free((int)$prid)) {
            // no charge for attribute
          } else {
            // + or blank adds
            if ($attribute_price->fields['price_prefix'] == '-') {
// appears to confuse products priced by attributes
                if ($product->fields['product_is_always_free_shipping'] == '1') {
                  $shipping_attributes_price = zen_get_discount_calc($product->fields['products_id'], $attribute_price->fields['products_attributes_id'], $attribute_price->fields['options_values_price'], $qty);
                  $this->free_shipping_price -= $qty * zen_add_tax( ($shipping_attributes_price), $products_tax);
                }
              if ($attribute_price->fields['attributes_discounted'] == '1') {
                // calculate proper discount for attributes
                $new_attributes_price = zen_get_discount_calc($product->fields['products_id'], $attribute_price->fields['products_attributes_id'], $attribute_price->fields['options_values_price'], $qty);
                $this->total -= $qty * zen_add_tax( ($new_attributes_price), $products_tax);
              } else {
                $this->total -= $qty * zen_add_tax($attribute_price->fields['options_values_price'], $products_tax);
              }
            } else {
// appears to confuse products priced by attributes
                if ($product->fields['product_is_always_free_shipping'] == '1') {
                  $shipping_attributes_price = zen_get_discount_calc($product->fields['products_id'], $attribute_price->fields['products_attributes_id'], $attribute_price->fields['options_values_price'], $qty);
                  $this->free_shipping_price += $qty * zen_add_tax( ($shipping_attributes_price), $products_tax);
                }
              if ($attribute_price->fields['attributes_discounted'] == '1') {
                // calculate proper discount for attributes
                $new_attributes_price = zen_get_discount_calc($product->fields['products_id'], $attribute_price->fields['products_attributes_id'], $attribute_price->fields['options_values_price'], $qty);
                $this->total += $qty * zen_add_tax( ($new_attributes_price), $products_tax);
              } else {
                $this->total += $qty * zen_add_tax($attribute_price->fields['options_values_price'], $products_tax);
              }
            } // eof: attribute price

See if that fixes the shipping prices on the Free Shipping with zones for you ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

16 Feb 2007, 2:16 PM
#9
ktnaturals avatar

ktnaturals

Zen Follower

Join Date:
Dec 2006
Location:
Ohio
Posts:
196
Plugin Contributions:
0

Re: [Done 1.3.8] Products priced by attribute calculates wrong shipping

It fixed it for products (and virtual prod) marked free shipping, but not gift certificates where they're not supposed to be marked free shipping...

I'll either just not do the attributes for the GC or mark it free shipping. At least I have workarounds now.

Thanks for the fix!

16 Feb 2007, 2:19 PM
#10
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: [Done 1.3.8] Products priced by attribute calculates wrong shipping

Try changing the two IF statements around the $shipping_attributes_price to read:

                if ($product->fields['product_is_always_free_shipping'] == '1' or $product->fields['products_virtual'] == '1') {

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

16 Feb 2007, 2:26 PM
#11
ktnaturals avatar

ktnaturals

Zen Follower

Join Date:
Dec 2006
Location:
Ohio
Posts:
196
Plugin Contributions:
0

Re: [Done 1.3.8] Products priced by attribute calculates wrong shipping

Nope, didn't work. :(

16 Feb 2007, 2:28 PM
#12
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: [Done 1.3.8] Products priced by attribute calculates wrong shipping

Make sure you have that on the correct 2 lines:

          // bottom total
          //            if ($attribute_price->fields['product_attribute_is_free']) {
          if ($attribute_price->fields['product_attribute_is_free'] == '1' and zen_get_products_price_is_free((int)$prid)) {
            // no charge for attribute
          } else {
            // + or blank adds
            if ($attribute_price->fields['price_prefix'] == '-') {
// appears to confuse products priced by attributes
                if ($product->fields['product_is_always_free_shipping'] == '1' or $product->fields['products_virtual'] == '1') {
                  $shipping_attributes_price = zen_get_discount_calc($product->fields['products_id'], $attribute_price->fields['products_attributes_id'], $attribute_price->fields['options_values_price'], $qty);
                  $this->free_shipping_price -= $qty * zen_add_tax( ($shipping_attributes_price), $products_tax);
                }
              if ($attribute_price->fields['attributes_discounted'] == '1') {
                // calculate proper discount for attributes
                $new_attributes_price = zen_get_discount_calc($product->fields['products_id'], $attribute_price->fields['products_attributes_id'], $attribute_price->fields['options_values_price'], $qty);
                $this->total -= $qty * zen_add_tax( ($new_attributes_price), $products_tax);
              } else {
                $this->total -= $qty * zen_add_tax($attribute_price->fields['options_values_price'], $products_tax);
              }
            } else {
// appears to confuse products priced by attributes
                if ($product->fields['product_is_always_free_shipping'] == '1' or $product->fields['products_virtual'] == '1') {
                  $shipping_attributes_price = zen_get_discount_calc($product->fields['products_id'], $attribute_price->fields['products_attributes_id'], $attribute_price->fields['options_values_price'], $qty);
                  $this->free_shipping_price += $qty * zen_add_tax( ($shipping_attributes_price), $products_tax);
                }
              if ($attribute_price->fields['attributes_discounted'] == '1') {
                // calculate proper discount for attributes
                $new_attributes_price = zen_get_discount_calc($product->fields['products_id'], $attribute_price->fields['products_attributes_id'], $attribute_price->fields['options_values_price'], $qty);
                $this->total += $qty * zen_add_tax( ($new_attributes_price), $products_tax);
              } else {
                $this->total += $qty * zen_add_tax($attribute_price->fields['options_values_price'], $products_tax);
              }
            } // eof: attribute price

Seemed to clear things up for me ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

16 Feb 2007, 2:33 PM
#13
ktnaturals avatar

ktnaturals

Zen Follower

Join Date:
Dec 2006
Location:
Ohio
Posts:
196
Plugin Contributions:
0

Re: [Done 1.3.8] Products priced by attribute calculates wrong shipping

A ha! That worked! Thank you very much!!

17 Feb 2007, 12:53 AM
#14
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: [Done 1.3.8] Products priced by attribute calculates wrong shipping

Know how I knew you had a typo?

I did the exact same typo when I retested the code for that last fix ... :lamo:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

28 Jun 2007, 11:41 PM
#15
birdmag avatar

birdmag

New Zenner

Join Date:
Jun 2007
Posts:
8
Plugin Contributions:
0

Re: [Done 1.3.8] Products priced by attribute calculates wrong shipping

Hello Ajeh,

I'm having an issue very similar to KTNaturals, so I'll post to this thread since it has a history.

I'm running a cart at http://www.birdwatchersdigest.com/shop/. As with KTNaturals, we have collectors prints set up for free shipping (and the prints have attributes, each of which increases the price). Naturally we want the product to have free shipping regardless of what attribute is selected. What I've noticed is this - if I select any print and attribute AND the print is the only thing in my cart, then the shipping is always free, which is what I want. But - if I put another product in the cart, for example anything from Birding Gear, then shipping appears to increase as if the extra price of the print's attribute is included in the shipping calculation. Here's an example:

Say I have collectors prints > Shorebirds > Fog is rising, selected double-matted for a total of $75. Go to checkout, and the shipping charges are $0 as they should be. Now add gear > binocular harness for $19.99, and look at checkout again. According to our table rate, the shipping should be $7.95, and it is being calculated at $10.95.

Like KTNaturals, I have shipping set up with a table rate that's based on price. In addition we also have a cutoff of free shipping at $50 (though my sense is that, if one of your purchases has free shipping, then you need $50 of non-free-shipping products for that to kick in). Our table rate is set up as follows:

15:5.95,30:7.95,50:10.95,5000:0

Note - we're running the latest version of ZenCart (v1.3.7), and I updated it just within the past few months - I noticed that the changes you suggested to KTNaturals appeared to already be there.

Can you confirm my suspicion that this issue might still exist? Either that, or can you walk me through the settings that might be resulting in this problem? Any assistance would be appreciated!

In advance, thanks!

29 Jun 2007, 2:19 AM
#16
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: [Done 1.3.8] Products priced by attribute calculates wrong shipping

If I understand your products right ... I have not re-produced this in the upcoming v1.3.8 ...

I have to find a clean v1.3.7 to test your's ...

But I am a bit confused on your cut off statement:

In addition we also have a cutoff of free shipping at $50 (though my sense is that, if one of your purchases has free shipping, then you need $50 of non-free-shipping products for that to kick in)

I am assuming that you mean that orders over $50, based on your Table Rate shipping settings go to $0.00 ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

29 Jun 2007, 3:38 AM
#17
birdmag avatar

birdmag

New Zenner

Join Date:
Jun 2007
Posts:
8
Plugin Contributions:
0

Re: [Done 1.3.8] Products priced by attribute calculates wrong shipping

Thanks for your quick attention! I think we're saying the same thing about the free shipping - in the example I posed, if you have a print for $75 and a second item for $19.99, the suborder total would be $94.99. But, that print for $75 is marked as free shipping, so that doesn't count toward the $50 total that you must have (or so that's my understanding - please don't hesitate to correct me if I'm wrong).

But that aside, my main mystery at the moment is why the print appears to be influencing the shipping calculation at all, when combined with two or more items. If the binocular harness is in the cart alone, its shipping is $7.95. If you have the print alone in the cart, its shipping is $0. I don't understand why, when you have them in the cart together, the shipping on the total order goes to $10.95. It seems as if the programming is looking at the $19.99 from the binocular harness, the extra $25 associated with the print attribute, and then calculating the shipping based on $44.99, which would place the shipping to $10.95 as listed in the table.

If you're interested in further information about my setup, please let me know; I'll be happy to provide anything that will help solve the mystery.

29 Jun 2007, 3:42 AM
#18
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: [Done 1.3.8] Products priced by attribute calculates wrong shipping

I believe mine is working fine ... for v1.3.8

Your's however could be this fix that I posted or I have to take another look at v1.3.7 and see which version we added that fix to as it escapes me at the moment and I have not looked this up yet ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

29 Jun 2007, 11:05 AM
#19
birdmag avatar

birdmag

New Zenner

Join Date:
Jun 2007
Posts:
8
Plugin Contributions:
0

Re: [Done 1.3.8] Products priced by attribute calculates wrong shipping

Hi Ajeh,

Originally I thought your changes were already in the 1.3.7 distribution (must not have been looking at the code close enough), though it looks like you were right - your change had not been applied in that version. Once I copy-pasted your code it looks like that end up solving the bug (my apologies for the alarm - looks like this was an easy one for you!)

1 Jul 2007, 4:53 AM
#20
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: [Done 1.3.8] Products priced by attribute calculates wrong shipping

Sure ... umm ... yeah ... easy ... :blink:

Only went slightly blind finding it ... but sure am glad it is fixed for the up coming release ... :cool:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!