Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
That works :) Thanks so much Linda :)
Now I just have one last question...
I have two different drop-shipping rates for different products (say A for $15 and B for $35), and then use Per Item for the products I stock.
So, when a customer has any number of drop-ship A in their cart, Flat Rate #1 at $15 will be the only option available. The same goes for each of the other products - Flat Rate #2 at $35, Per Item at $6, etc.
I want to have just one shipping method as the only option, no matter what a customer has in their cart, but this next part is confusing me as to how to get it to work:
If a customer buys one of each of the drop-shipped items (A and B), Flat Rate #2 ($35) would be the only option.
And if a customer buys either of the drop-shipped items (A or B), combined with products I stock, then the respective shipping rate would show. For example, if a customer buys an item from A as well as items I stock, the shipping would be Flat Rate #1 at $15. If item A was changed to B, then the shipping would be #2 at $35.
How would I get all this into the code?
Again - thanks so much for your help. I REALLY appreciate it :)
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
If you were to add this code into the quote section of the Item Rate item shipping module:
Code:
// check if manufacturer 1 or 2 is in cart
if (IS_ADMIN_FLAG == false) {
global $cart;
$chk_manufacturers_id1 = $_SESSION['cart']->in_cart_check('manufacturers_id', '1');
$chk_manufacturers_id2 = $_SESSION['cart']->in_cart_check('manufacturers_id', '2');
$chk_manufacturers_id = $chk_manufacturers_id1 + $chk_manufacturers_id2;
}
You would know how many items are from manufacturers_id 1 and from manufacturers_id 2 ...
The Item Rate is using the number of items in the cart ...
If you were to subtract from the number of items about to be calculated the $chk_manufacturers_id you would then just be charging the Item Rate for all products not in 1 and 2 ... just under this code in item.php
Code:
// adjusted count for free shipping
$item_total_count = $total_count - $_SESSION['cart']->free_shipping_items();
then, you can add in the extra charge for the Flat Rate amount to this calculation based on $chk_manufacturers_id1 >= 1 add $15.00 and $chk_manufacturers_id2 >= 1 add $35 ... by adjusting the code in this section:
Code:
$this->quotes = array('id' => $this->code,
'module' => MODULE_SHIPPING_ITEM_TEXT_TITLE,
'methods' => array(array('id' => $this->code,
'title' => MODULE_SHIPPING_ITEM_TEXT_WAY,
'cost' => (MODULE_SHIPPING_ITEM_COST * $item_total_count) + MODULE_SHIPPING_ITEM_HANDLING)));
So Flat Rate should only be used for manufacturers_id 1 and 2 and the amounts altered to $15 or $35 or both ... otherwise, Flat Rate should not show if there are other products in the cart ...
Item Rate should be altered to not show when only products are from manufacturers_id 1 and 2 ...
Item Rate should be altered to reduce the item count based on anything from manufacturers_id 1 and 2 ... and add the additional charges for manufacturers_id 1 and 2 ...
Note: in theory, this could all be done in Item Rate item as the Item Rate would be 0 when only products are from manufacturers_id 1 and 2 ... and then the calculations for manufacturers_id 1 and 2 would be used ... providing you write the code correctly ... :cool:
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
Well, I added the codes into the modules, but now the shipping estimate shows two Per Item methods, instead of Flat Rate, when I have manufacturers 1 and/or 2 in the cart (the one that should be Flat Rate is showing at $0).
The Per Item module (the one that's supposed to show) is fine when I have products from any other manufacturer in the cart, and it is the only option available.
I'm thinking it has something to do with this part you mentioned:
Quote:
Originally Posted by
Ajeh
If you were to subtract from the number of items about to be calculated the $chk_manufacturers_id you would then just be charging the Item Rate for all products not in 1 and 2 ... just under this code in item.php
Code:
// adjusted count for free shipping
$item_total_count = $total_count - $_SESSION['cart']->free_shipping_items();
I don't quite understand what you mean by this... am I supposed to add a piece of coding here?
Thanks again,
Tija
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
If you only used the Item Rate item shipping module ... you would do the calculation for the two manufacturers_id in it ...
NOTE: based on where the code is you do not need to test for if in the admin or not ...
Change the quote function to:
Code:
// class methods
function quote($method = '') {
global $order, $total_count;
// check if manufacturer 1 or 2 is in cart
global $cart;
$chk_manufacturers_id1 = $_SESSION['cart']->in_cart_check('manufacturers_id', '1');
$chk_manufacturers_id2 = $_SESSION['cart']->in_cart_check('manufacturers_id', '2');
$chk_manufacturers_id = $chk_manufacturers_id1 + $chk_manufacturers_id2;
// calculate charges for manufacturers 1 or 2
$extra_manufacturers_charge = 0.00;
if ($chk_manufacturers_id1 > 0) {
$extra_manufacturers_charge += 15;
}
if ($chk_manufacturers_id2 > 0) {
$extra_manufacturers_charge += 35;
}
// adjust count for manufacturers
// adjusted count for free shipping
$item_total_count = $total_count - $chk_manufacturers_id1 - $chk_manufacturers_id2 - $_SESSION['cart']->free_shipping_items();
$this->quotes = array('id' => $this->code,
'module' => MODULE_SHIPPING_ITEM_TEXT_TITLE,
'methods' => array(array('id' => $this->code,
'title' => MODULE_SHIPPING_ITEM_TEXT_WAY,
'cost' => $extra_manufacturers_charge + (MODULE_SHIPPING_ITEM_COST * $item_total_count) + MODULE_SHIPPING_ITEM_HANDLING)));
This way, there is only one shipping method handling everything ...
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
Well, that works for the two separate drop-ship prices, but this part doesn't seem to be working:
Code:
// adjust count for manufacturers
// adjusted count for free shipping
$item_total_count = $total_count - $chk_manufacturers_id1 - $chk_manufacturers_id2 - $_SESSION['cart']->free_shipping_items();
$this->quotes = array('id' => $this->code,
'module' => MODULE_SHIPPING_ITEM_TEXT_TITLE,
'methods' => array(array('id' => $this->code,
'title' => MODULE_SHIPPING_ITEM_TEXT_WAY,
'cost' => $extra_manufacturers_charge + (MODULE_SHIPPING_ITEM_COST * $item_total_count) + MODULE_SHIPPING_ITEM_HANDLING)));
When I have the two different manufacturers in the cart, the shipping adds together - so it comes to $50 instead of $35 for the combined drop-ship items, and just adds the Per Item rate onto those rates for drop-ship products combined with products I stock.
Any ideas?
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
Could you post the whole quote portion of the item.php file so that we can see what you are using right now?
NOTE: this is the only portion of the code that should be changed and the only shipping module that should be installed ...
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
Hopefully this is the correct part of the code... I'm not familiar with PHP at all :unsure:
Code:
// class methods
function quote($method = '') {
global $order, $total_count;
// check if manufacturer 1 or 2 is in cart
global $cart;
$chk_manufacturers_id1 = $_SESSION['cart']->in_cart_check('manufacturers_id', '1');
$chk_manufacturers_id2 = $_SESSION['cart']->in_cart_check('manufacturers_id', '2');
$chk_manufacturers_id = $chk_manufacturers_id1 + $chk_manufacturers_id2;
// calculate charges for manufacturers 1 or 2
$extra_manufacturers_charge = 0.00;
if ($chk_manufacturers_id1 > 0) {
$extra_manufacturers_charge += 15;
}
if ($chk_manufacturers_id2 > 0) {
$extra_manufacturers_charge += 35;
}
// adjust count for manufacturers
// adjusted count for free shipping
$item_total_count = $total_count - $chk_manufacturers_id1 - $chk_manufacturers_id2 - $_SESSION['cart']->free_shipping_items();
$this->quotes = array('id' => $this->code,
'module' => MODULE_SHIPPING_ITEM_TEXT_TITLE,
'methods' => array(array('id' => $this->code,
'title' => MODULE_SHIPPING_ITEM_TEXT_WAY,
'cost' => $extra_manufacturers_charge + (MODULE_SHIPPING_ITEM_COST * $item_total_count) + MODULE_SHIPPING_ITEM_HANDLING)));
if ($this->tax_class > 0) {
$this->quotes['tax'] = zen_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
}
if (zen_not_null($this->icon)) $this->quotes['icon'] = zen_image($this->icon, $this->title);
return $this->quotes;
}
Quote:
NOTE: this is the only portion of the code that should be changed and the only shipping module that should be installed ...
I haven't altered any other part of the code and it is the only module installed except for Zone Rates, as I ship internationally.
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
What charges do you get if you add 1 product from manufacturers_id 1?
What charges do you get if you add 2 product from manufacturers_id 1?
What charges do you get if you add 1 product from manufacturers_id 2?
What charges do you get if you add 2 product from manufacturers_id 2?
What charges do you get if you add 1 product from manufacturers_id 1 and 1 product from manufacturers_id 2?
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
Quote:
what charges do you get if you add 1 product from manufacturers_id 1?
$15
Quote:
what charges do you get if you add 2 product from manufacturers_id 1?
$15
Quote:
what charges do you get if you add 1 product from manufacturers_id 2?
$35
Quote:
what charges do you get if you add 2 product from manufacturers_id 2?
$35
Quote:
what charges do you get if you add 1 product from manufacturers_id 1 and 1 product from manufacturers_id 2?
$50
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
Okay so that part is working fine to charge the correct amounts based on those two manufacturers_id values ...
Now, you should have your Item Rate setup to charge a certain amount per item when you add a Product to the order that is not in manufacturers_id 1 or 2 ...
If you add 1 Product to the order that is not in manufacturers_id 1 or 2 what is the amount?
If you add 2 Product to the order that is not in manufacturers_id 1 or 2 what is the amount?
If you add 1 Product to the order that is not in manufacturers_id 1 or 2 and add 1 Product from manufacturers_id 1 what is the amount?
If you add 2 Product to the order that is not in manufacturers_id 1 or 2 and add 1 Product from manufacturers_id 1 what is the amount?