Ajeh:
In the new USPS July 28, 2013 J5 shipping module, you can customize whether the module is enabled or disabled a little differently than in the past ...
Look for the code for update_status() and add the code in RED:
function update_status() {
global $order, $db;
if (IS_ADMIN_FLAG == TRUE) return;
// disable only when entire cart is free shipping
if (zen_get_shipping_enabled($this->code)) {
$this->enabled = ((MODULE_SHIPPING_USPS_STATUS == 'True') ? true : false);
}
[B]// bof: turn off when manufacturers_id 3, 10
$chk_manufacturers = 0;
$products = $_SESSION['cart']->get_products();
for ($i=0, $n=sizeof($products); $i<$n; $i++) {
$chk_manufacturers_id = zen_get_products_manufacturers_id((int)$products[$i]['id']);
if ($chk_manufacturers_id == 3 || $chk_manufacturers_id == 10) {
$chk_manufacturers ++;
}
//echo '(int)$products[$i][id]: ' . (int)$products[$i]['id'] . ' $chk_manufacturers_id: ' . $chk_manufacturers_id . ' $chk_manufacturers: ' . $chk_manufacturers . '<br>';
}
if ($chk_manufacturers > 0) {
$this->enabled = false;
}
// eof: turn off when manufacturers_id 3, 10
[/B]
if ($this->enabled == true) {
>
> manufacturers_id is a little different than checking the master_categories_id and some of the other fields as it is not really a part of the class shopping_cart so you need an extra step to identify which manufacturers_id belongs to the Product ...
>
> This test is just counting how many times a manufacturers_id belongs to the Product for manufacturers_id 3 and 10 ... you can change those to the values you need or add more or less to be tested to the IF:
> ```
[B] if ($chk_manufacturers_id == 3) {
[/B]
[B] if ($chk_manufacturers_id == 3 || [/B][B]$chk_manufacturers_id == 10 || [/B][B]$chk_manufacturers_id == 12[/B][B]) {
[/B]
Thanks so much! I downloaded the newest usps shipping module like you suggested and put in the following code after replacing the manufacturers ids with the correct ones. I created a couple of test products from that manufacturer but usps still shows at the checkout.
> function update_status() {
> global $order, $db;
> if (IS_ADMIN_FLAG == TRUE) return;
>
> // disable only when entire cart is free shipping
> if (zen_get_shipping_enabled($this->code)) {
> $this->enabled = ((MODULE_SHIPPING_USPS_STATUS == 'True') ? true : false);
> }
> // bof: turn off when manufacturers_id 182, 183
> $chk_manufacturers = 0;
> $products = $_SESSION['cart']->get_products();
> for ($i=0, $n=sizeof($products); $i<$n; $i++) {
> $chk_manufacturers_id = zen_get_products_manufacturers_id((int)$products[$i]['id']);
> if ($chk_manufacturers_id == 182 || $chk_manufacturers_id == 183) {
> $chk_manufacturers ++;
> }
> //echo '(int)$products[$i][id]: ' . (int)$products[$i]['id'] . ' $chk_manufacturers_id: ' . $chk_manufacturers_id . ' $chk_manufacturers: ' . $chk_manufacturers . '<br>';
> }
> if ($chk_manufacturers > 0) {
> $this->enabled = false;
> }
> // eof: turn off when manufacturers_id 182, 183
>
> if ($this->enabled == true) {
Also now the usps option is showing an odd string of characters in the estimated shipping calculator and at the checkout. Here's a link the the test product. <http://www.needleworkfool.com/index.php?main_page=product_info&cPath=8_9&products_id=182> I'm not sure what I did wrong :unsure: