The file was empty, it couldn't been opened.
This is the only "Need Help With Shipping" thread that is not closed.
Sorry if this is off the topic of the original post...but as usual, I can't find the place to start a new thread.
I've searched and read several threads related to "multiple ship origin zip codes", "shipping help", "dropship shipping", etc. None of the threads I've ran across in the last couple of days have a usable answer.
I have multiple ship origin zip codes for my products (114,000) but Zencart only has one location for shipping ORIGIN zip code...which is set in admin/configuration/shipping/packing/postal code.
I need to replace the admin ship origin zip code with each products unique ship origin zip code just before it is evaluated for UPS shipping cost. I believe(hope) that is the only change I need to make in order to get accurate shipping cost for each product.
I've added a column to my products table, "ship_zip" for each product but I need a way to plug that zip code into shipping cost evaluation process.
I have studied the ups.php module in depth and I know (think) I need to change the configuration table just before line 148:
with a simple query like:PHP Code:$this->_upsOrigin(SHIPPING_ORIGIN_ZIP, $country_name['countries_iso_code_2']);
What variable is represents the products_id during the shipping cost evaluation process?PHP Code:[B]$products_ship_zip[/B] = $db->query("SELECT ship_zip FROM products WHERE products_id = PRODUCT BEING EVALUATED FOR SHIPPING");
$query = ("UPDATE $configuration
SET $configuration.`configuration_value` = [B]'$products_ship_zip'[/B]
WHERE $configuration.`configuration_key` = 'SHIPPING_ORIGIN_ZIP' ");
$stmt = $db->prepare($query);
$stmt->execute();
I've tried echo testing the ups.php module but can not put my finger on the products_id variable.
Does the ups.php module evaluate shipping cost a product at a time or in bulk? I'm assuming one at at time.
Should I be setting the $products_ship_zip and changing the configuration in a different file?
Thanks in advance for any help anyone can provide.
Last edited by mikeel100; 22 Oct 2015 at 12:01 AM.
Yes, that is correct. Thanks for the quick reply.
I think I have found the variable ($prid) that represents the product_id of the product being evaluated for shipping:)
I'm getting ready to plug in my code above using this variable to change the ship origin in admin and see if this changes the ship origin to the product I am testing with.
I'll post results here.
The problem is if someone orders 2 products, then which zipcode should it use.
There is a shipping module out there that would do what your looking for, however it is no longer being sold/supported because of an issue with the licensing and the family.
If I were to do this, I would some how "hack" together a way to group the products from each zipcode and then cycle through the UPS module.
Around line 653 of /includes/classes/shopping_cart.php...
Echo testing showed the correct origin zip for each of the 3 products in the customers shopping cart...whether it processed the shipping module one product at a time is still fuzzy.PHP Code:// products price - MIKE ADDED ship_zip
$product_query = "select products_id, products_price, products_tax_class_id, products_weight,
products_priced_by_attribute, product_is_always_free_shipping, products_discount_type,
products_discount_type_from,
products_virtual, products_model, ship_zip
from " . TABLE_PRODUCTS . "
where products_id = '" . (int)$products_id . "'";
if ($product = $db->Execute($product_query)) {
$prid = $product->fields['products_id'];
$products_tax = zen_get_tax_rate($product->fields['products_tax_class_id']);
$products_price = $product->fields['products_price'];
/*MIKE ADDED TO CHANGE SHIP ORIGIN FOR EACH PRODUCT*/
$ship_zip = $product->fields['ship_zip'];
//echo $ship_zip." SHIP FROM ZIP";
$db->Execute("update " . TABLE_CONFIGURATION . "
SET `configuration_value` = '$ship_zip'
WHERE `configuration_key` = 'SHIPPING_ORIGIN_ZIP' ");
/*END MIKE ADDED*/
The code does update admin with the correct ship origin on single product testing...but, again, I'm not sure how the shipping is calculated. One product at a time or in bulk???
For now, it is better than playing roulette on my orders.
If someone could point out the pros and cons of this method, I would appreciate it.
Last edited by mikeel100; 22 Oct 2015 at 03:31 AM. Reason: Edited out echo from php code
So, the remaining question I have is:
Do products enter the ups.php one at a time or in bulk?
Thanks.