Forums / Addon Shipping Modules / Hide module from certain state

Hide module from certain state

Started by jimmie on 12 Nov 2014, 3:09 AM · Views: 3,404

Results 1 to 20 of 41
12 Nov 2014, 3:09 AM
#1
jimmie avatar

jimmie

Totally Zenned

Join Date:
Jan 2013
Location:
New Port Richey, Florida
Posts:
971
Plugin Contributions:
0

Hide module from certain state

Anyone using this module for freight quotes in zencart-version 1.51
How is it working for you.

12 Nov 2014, 10:02 PM
#2
jimmie avatar

jimmie

Totally Zenned

Join Date:
Jan 2013
Location:
New Port Richey, Florida
Posts:
971
Plugin Contributions:
0

Re: Hide module from certain state

i believe this module is the same one that is in the downloads and was written for version 1.37, I downloaded from Frieghtquote.com
i am running zen-cart version 1.51 and have installed this module. It is working however there are a few issues with it.

  1. wont change from customer provided input. For instance i have default of Residential Checked off, When customer chooses Commercial It Processes but doesn't Change to Commercial. I think because v1.37 had a different database than v1.51
    2.Wont show a rate if weight has a decimal, Has to be rounded to the nearest Lb.
    Does anyone Know how to correct these issues?
    Thankyou
    Jimmie
13 Nov 2014, 1:47 AM
#3
jimmie avatar

jimmie

Totally Zenned

Join Date:
Jan 2013
Location:
New Port Richey, Florida
Posts:
971
Plugin Contributions:
0

Re: Hide module from certain state

  1. Also does not show a rate if not logged in
18 Nov 2014, 2:37 AM
#4
jimmie avatar

jimmie

Totally Zenned

Join Date:
Jan 2013
Location:
New Port Richey, Florida
Posts:
971
Plugin Contributions:
0

Re: Hide module from certain state

i need to change this code

$shipping_form .= '<select name="freightquote_delivery_location" onchange="window.location.href=\'' . zen_href_link(FILENAME_CHECKOUT_SHIPPING, 'freightquote_delivery_location=') . '\'+this.value">';

i have a default choose selected,when they go to shopping cart it shows my default selection (Residence). Right now when a customer chooses another selection (Commercial) it redirects them to FILENAME_CHECKOUT_SHIPPING with (Residence) still selectedand will not change.

i changed the code to this

$shipping_form .= '<select name="freightquote_delivery_location" onchange="window.location.href=\'' . zen_href_link(FILENAME_SHOPPING_CART, 'freightquote_delivery_location=') . '\'+this.value">';

and when on shopping page it works as expected.but checkout shipping still doesnt work goes back to FILENAME_SHOPPING_CART, need the proper name to go in here so it works on both pages

21 Nov 2014, 3:46 AM
#5
jimmie avatar

jimmie

Totally Zenned

Join Date:
Jan 2013
Location:
New Port Richey, Florida
Posts:
971
Plugin Contributions:
0

Re: Hide module from certain state

i need to hide FLORIDA from showing, but show to everyone else.(i use another module to handle Florida)
i added this because i dont want it to show if under 150 to anyone

if (!IS_ADMIN_FLAG) {      
      global $cart;      
      if ($_SESSION['cart']->weight < 150 ) {        
      $this->enabled = false;       
     }     }

thankyou
jimmie

21 Nov 2014, 1:23 PM
#6
ajeh avatar

ajeh

Oba-san

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

Re: Hide module from certain state

Could you give more details?

What are you trying to hide from FLORIDA?

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!

21 Nov 2014, 5:23 PM
#7
jimmie avatar

jimmie

Totally Zenned

Join Date:
Jan 2013
Location:
New Port Richey, Florida
Posts:
971
Plugin Contributions:
0

Re: Hide module from certain state

Don't want shipping module to show when customer wants it shipped to Florida or show if under 150 lbs.

21 Nov 2014, 6:34 PM
#8
ajeh avatar

ajeh

Oba-san

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

Re: Hide module from certain state

You could try this, for example if you were customizing the Zone Rate zones shipping module you would add the code in RED:

      // disable only when entire cart is free shipping
      if (zen_get_shipping_enabled($this->code)) {
        $this->enabled = ((MODULE_SHIPPING_ZONES_STATUS == 'True') ? true : false);
      }

[B]      global $total_weight, $order;
      //echo 'zones total_weight: ' . $total_weight . ' Zone: ' . $order->delivery['zone_id'] . '<br>';
      if ($order->delivery['zone_id'] == 18 || $total_weight >= 150) {
        $this->enabled = false;
      }
[/B]

Where 18 is the zone_id for Florida ...

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!

21 Nov 2014, 6:44 PM
#9
jimmie avatar

jimmie

Totally Zenned

Join Date:
Jan 2013
Location:
New Port Richey, Florida
Posts:
971
Plugin Contributions:
0

Re: Hide module from certain state

At work try it later, but does it disable under 150 everywhere else.
thankyou

21 Nov 2014, 6:51 PM
#10
ajeh avatar

ajeh

Oba-san

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

Re: Hide module from certain state

Change that to < vs >= as I wrote that backwards ...

The limit for weight is to block it for everyone ...

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!

21 Nov 2014, 9:29 PM
#11
jimmie avatar

jimmie

Totally Zenned

Join Date:
Jan 2013
Location:
New Port Richey, Florida
Posts:
971
Plugin Contributions:
0

Re: Hide module from certain state

thank you that works.
can you help me with a couple more?
Like this One

if ($data->fields['products_freightquote_enable'] == '1') {
          $product_list[] = array(
            'Class' => (zen_not_null($data->fields['products_freightquote_class']) ? $data->fields['products_freightquote_class'] : '50'),
            'ProductDescription' => $product['name'],
            'Weight' => ceil($product['quantity'] * (int)$product['weight']),
            'Length' => ceil($data->fields['products_freightquote_length']),
            'Width' => ceil($data->fields['products_freightquote_width']),
            'Height' => ceil($data->fields['products_freightquote_height']),
            'PackageType' => (zen_not_null($data->fields['products_freightquote_package_type']) ? $data->fields['products_freightquote_package_type'] : 'Boxes'),
            'DeclaredValue' => round($product['price']),
            'CommodityType' => (zen_not_null($data->fields['products_freightquote_commodity_type']) ? $data->fields['products_freightquote_commodity_type'] : 'GeneralMerchandise'),
            'ContentType' => (zen_not_null($data->fields['products_freightquote_content_type']) ? $data->fields['products_freightquote_content_type'] : 'NewCommercialGoods'),
            'IsHazardousMaterial' => $data->fields['products_freightquote_hzmt'],
            'NMFC' => $data->fields['products_freightquote_nmfc'],
            'PieceCount' => ceil$product['quantity'], Added ceil here
            'ItemNumber' => $counter
          );

The 'Weight' code in red does not round or mutiply, is there another way to write this to round product quantity and product weight, then mutiply?
'Piececount' also in red, i just need to add round or ceil to the front.

21 Nov 2014, 11:10 PM
#12
ajeh avatar

ajeh

Oba-san

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

Re: Hide module from certain state

You have in there:

            'Weight' => ceil($product['quantity'] * (int)$product['weight']),

The (int)$product['weight'] means take:
5.75 = 5
6.25 = 6
3.10 = 3
6.99 = 6

This is coded wrong:

            'PieceCount' => ceil$product['quantity'], Added ceil here

What is the goal for:

 
'Weight' => 

and for:

 'PieceCount' => 

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!

21 Nov 2014, 11:34 PM
#13
jimmie avatar

jimmie

Totally Zenned

Join Date:
Jan 2013
Location:
New Port Richey, Florida
Posts:
971
Plugin Contributions:
0

Re: Hide module from certain state

the goal for weight is to determine the products weight and not the weight of the cart
Piececount = how many pieces

21 Nov 2014, 11:39 PM
#14
jimmie avatar

jimmie

Totally Zenned

Join Date:
Jan 2013
Location:
New Port Richey, Florida
Posts:
971
Plugin Contributions:
0

Re: Hide module from certain state

this is the way i edited it in the file

'PieceCount' => round($product['quantity']),
21 Nov 2014, 11:45 PM
#15
ajeh avatar

ajeh

Oba-san

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

Re: Hide module from certain state

Humor me for a minute ...

What do you expect the results of:
(int)5.99 =
ceil(100 * (int)5.99) =

What kinds of Product Weight do you use, give 7 examples ...

What kinds of Product Quantities do you get on orders, give 7 examples ...

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!

22 Nov 2014, 12:17 AM
#16
jimmie avatar

jimmie

Totally Zenned

Join Date:
Jan 2013
Location:
New Port Richey, Florida
Posts:
971
Plugin Contributions:
0

Re: Hide module from certain state

i did not write this freightquote, thought that because it was written for v1.37 might have to make changes to work. as it stands this module does not work with sq ft. without some modifications. Have spoken with freightquote.com and he agrees that their api does not do decimals. i sell some products by the sq. ft. and have set min-max up. there is 18.94 sq ft. in carton. that carton weighs 30 lbs, i cant put 30 as weight. 30 x 18.94. so i divided 18.94 into 30=1.583949313621964 lbs per foot. that is what i enter as weight.
p. s. every freightquote module written for other carts is the same

22 Nov 2014, 12:20 AM
#17
jimmie avatar

jimmie

Totally Zenned

Join Date:
Jan 2013
Location:
New Port Richey, Florida
Posts:
971
Plugin Contributions:
0

Re: Hide module from certain state

a person could order 1200 ft of laminate add couple rolls of underlayment add some moldings. there is 1200+ quantity

22 Nov 2014, 12:24 AM
#18
jimmie avatar

jimmie

Totally Zenned

Join Date:
Jan 2013
Location:
New Port Richey, Florida
Posts:
971
Plugin Contributions:
0

Re: Hide module from certain state

if i use this than whole cart is weighed, i drop ship and if they have other than flooring it will be wrong weight

'Weight' => ceil($_SESSION['cart']->weight),
22 Nov 2014, 12:28 AM
#19
ajeh avatar

ajeh

Oba-san

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

Re: Hide module from certain state

So if you have:
Quantity 1200 and Weight 1.583949313621964

What do you want it to equal?
1200 * 1.583949313621964 = 1900.7391763464
-- or --
ceil(1200 * (int)1.583949313621964) = 1200
-- or --
ceil(1200 * 1.583949313621964) = 1901

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!

22 Nov 2014, 12:28 AM
#20
jimmie avatar

jimmie

Totally Zenned

Join Date:
Jan 2013
Location:
New Port Richey, Florida
Posts:
971
Plugin Contributions:
0

Re: Hide module from certain state

you be wondering why i dont switch over to sell by the carton. Well because most customers understand sq ft. When they measure they get sq ft. Easier to know