Do you anywhere in the code add this value:
$cat_extra_charge
to the $cost or something so it is included?![]()
Do you anywhere in the code add this value:
$cat_extra_charge
to the $cost or something so it is included?![]()
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!
Gotcha, yes, I left this very little but all important piece of the puzzle out:
Thank you! It's now adding the $5.00 extra cost!PHP Code:'cost' => $cat_extra_charge + ($cost * $shipping_num_boxes)
In terms of the echo I had added to explain the whole deal about the added shipping cost, is there a reason why it wasn't working with it, and taking out the echo fixed the blank page error? I'd really like to have this paragraph in there.
One more question, I now have another product with a similar situation, I need to apply a flat rate to this whole category but it will be a different amount than the $5.00, so I need to write more code for it. I'm sure I can figure out how to duplicate it for this, but my main question is would I just add the new code to these same files, or should I make a clone of the usps.php and in the second one have the customized code for the new product? Guess I'm not sure why or when you'd want to clone a shipping module.
THANK YOU!!!!!!!!!!!!!!!!!!!!!!
You would just do the same thing based on the different information such as using the master_categories_id ...
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!
Wouldn't I clone the flat if I want a different flat rate for the other product?
Sorry, yes ... you need to clone Flat Rate flat for the new rate and Category and on the USPS you need to add the new calculation just like you had the other one ...
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!
After much thought, and trying to configure the two cloned flat rates (and after studying code in other similar posts), I finally realized that I think this can be done with just one flat.php file.
The usps.php is working perfectly, if the weight of the items in the cart is more than 0 it is activated, and if there are manufacturers 1 and or 2 in the cart it adds the appropriate extra flat fees.
I used basically the same code in the flat.php, if the total cart weight is 0 it is activated, then it is supposed to look for manufacturers 1 & 2 and add the correct flat fees together.
My thought is to configure the flat fee under shipping modules in my admin to be $0, and then just have the extra flat fees added.
I know something is wrong with this file, because once I added the extra code in, the shipping modules don't show in my admin. Take the code out, and they show.
Here is my custom code in the flat.php:
and for the cost part I did this:PHP Code:global $cart;
// check total cart weight
if (IS_ADMIN_FLAG == false) {
$chk_products_weight = $_SESSION['cart']->show_weight();
}
// enable if total product weight is 0
if (IS_ADMIN_FLAG == false && $chk_products_weight == 0) {
// show FLAT
$this->enabled = true;
} else {
// hide FLAT
$this->enabled = false;
}
//check if manufacturer 1 is in cart
if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('manufacturers_id','1') > 0)); {
$manufacturer_alchemy = $_SESSION['cart']->in_cart_check('manufacturers_id','1');
$drop_ship_extra_charge_one = $manufacturer_alchemy;
}
// charge dropship fee for manufacturer 1
if ($drop_ship_extra_charge_one > 0) {
$cat_extra_charge_one = 5;
} else {
$cat_extra_charge_one = 0;
}
//check if manufacturer 2 is in cart
if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('manufacturers_id','2') > 0)); {
$manufacturer_femme_metale = $_SESSION['cart']->in_cart_check('manufacturers_id','2');
$drop_ship_extra_charge_two = $manufacturer_femme_metale;
}
// charge dropship fee for manufacturer 2
if ($drop_ship_extra_charge_two > 0) {
$cat_extra_charge_two = 10;
} else {
$cat_extra_charge_two = 0;
}
Any ideas of what is wrong here?PHP Code:'cost' => $cat_extra_charge_one + $cat_extra_charge_two
Thank you!!!!
Where have you placed your code?
You test to see if the module should be enabled or not, then go on to test for extra charges ...
Then change the cost to your calculated costs ...
You are also showing the semi-colons on your IF statements:
Code:if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('manufacturers_id','1') > 0)); {
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!
Ok, taking the bad semicolons out made the shipping modules show back up in admin, that's good. I also moved the code for testing for the different manufacturers down. I'm very close, if manufacturer 1 is in the cart it is showing the correct shipping cost, but it doesn't add anything if manufacturer 2 is in there. Here's my code in red:
PHP Code:global $cart;
//check if manufacturer 1 and 2 is in cart
$chk_manufacturers_alchemy = $_SESSION['cart']->in_cart_check('manufacturers_id', '1');
$chk_manufacturers_femme_metale = $_SESSION['cart']->in_cart_check('manufacturers_id', '2');
if ($chk_manufacturers_alchemy > 0) {
$chk_shipping_charges_one = 5.00;
} else {
$chk_shipping_charges_one = 0;
}
if ($chk_manufacturers_femme_metale > 0) {
$chk_shipping_charges_two = 10.00;
} else {
$chk_shipping_charges_two = 0;
}
Coffee is on it's way!!PHP Code:$this->quotes = array('id' => $this->code,
'module' => MODULE_SHIPPING_FLAT_TEXT_TITLE,
'methods' => array(array('id' => $this->code,
'title' => MODULE_SHIPPING_FLAT_TEXT_WAY,
'cost' => [COLOR="Red"]($chk_shipping_charges_one + $chk_shipping_charges_two) +[/COLOR] MODULE_SHIPPING_FLAT_COST)));
Are you sure your second Manufacturer is actually manufacturers_id 2 and not some other value?
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!
I believe it really is, the USPS module is working if I have an item from Alchemy, and item from Femme Metale (manufacturer 2), and a weighted product that triggers the USPS module, all the shipping fees added together are correct.
Under Manufacturers in Admin, I have three listed in this order: Alchemy, Femme Metale, and Other. Is there somewhere else to check the actual number for the manufacturer?