Forums / General Questions / Set a flat shipping cost for a single item

Set a flat shipping cost for a single item

Views: 2,357

Results 1 to 20 of 37
27 Mar 2012, 5:55 PM
#1
gloerick avatar

gloerick

Zen Follower

Join Date:
Feb 2006
Location:
Boise, ID
Posts:
330
Plugin Contributions:
0

Set a flat shipping cost for a single item

Hello Ajeh or any one :-)

How can I get a per item flat shipping cost on an item ?

I have a few items that ship same cost no matter what
and the normal shipping method raises the shipping to high.

Thx,
Erick

27 Mar 2012, 6:09 PM
#2
gloerick avatar

gloerick

Zen Follower

Join Date:
Feb 2006
Location:
Boise, ID
Posts:
330
Plugin Contributions:
0

Re: Set a flat shipping cost for a single item

also is there a way to have the cart HALF the weight shown per item for shipping.

or a way to quickly change ALL weights to HALF what they are currently set at at checkout, or I will have a whole lot of updating to do...

27 Mar 2012, 6:58 PM
#3
ajeh avatar

ajeh

Oba-san

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

Re: Set a flat shipping cost for a single item

Set the weight of the Product to 0, then, in the function quote of your shipping modules you could use:

    global $cart;
    $chk_products = 0;
    $extra_products_charge = 0.00;
// check for products_id 12 and add $5.00 to shipping
    $chk_products += $_SESSION['cart']->in_cart_check('products_id','12');
    if ($chk_products > 0) {
      $extra_products_charge = 5.00;
    }

Then, add the new variable:
$extra_products_charge

to the cost on your shipping module(s) ...

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!

27 Mar 2012, 7:18 PM
#4
gloerick avatar

gloerick

Zen Follower

Join Date:
Feb 2006
Location:
Boise, ID
Posts:
330
Plugin Contributions:
0

Re: Set a flat shipping cost for a single item

will give it a try,
also how to add like a small truck icon to the categories.php
page so that with each Item when it shows the other small icons such as status, sort, edit, move, copy and such.

add one as a small truck to show the item has free shipping set. free_shipping_set.png set in the same admin icon location as the other images such as the icon_edit.gif

27 Mar 2012, 7:40 PM
#5
gloerick avatar

gloerick

Zen Follower

Join Date:
Feb 2006
Location:
Boise, ID
Posts:
330
Plugin Contributions:
0

Re: Set a flat shipping cost for a single item

can the free shipping also be clickable like the status is to turn on and off the free shipping for that item ?

27 Mar 2012, 10:19 PM
#6
ajeh avatar

ajeh

Oba-san

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

Re: Set a flat shipping cost for a single item

You will need to write your own code for the:
/admin/includes/modules/category_product_listing.php

look around line 335-342 for:
action=setflag

to see how that is writen ... then look at the:
/admin/categories.php

around line 107 for:
case 'setflag':

and see how the code is written ...

You can build your custom code using the same method ...

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!

27 Mar 2012, 11:19 PM
#7
gloerick avatar

gloerick

Zen Follower

Join Date:
Feb 2006
Location:
Boise, ID
Posts:
330
Plugin Contributions:
0

Re: Set a flat shipping cost for a single item

is ok, It confuses me, I just do not understand php programing. will find someone to get it done.

28 Mar 2012, 6:00 AM
#8
gloerick avatar

gloerick

Zen Follower

Join Date:
Feb 2006
Location:
Boise, ID
Posts:
330
Plugin Contributions:
0

Re: Set a flat shipping cost for a single item

what would I use to replace the products_status in the code ?
what am I making a call for ?

28 Mar 2012, 6:03 AM
#9
gloerick avatar

gloerick

Zen Follower

Join Date:
Feb 2006
Location:
Boise, ID
Posts:
330
Plugin Contributions:
0

Re: Set a flat shipping cost for a single item

I looked in product.php, the file that seems to load to admin the item, but the word shipping is not in the code ?

28 Mar 2012, 6:13 AM
#10
gloerick avatar

gloerick

Zen Follower

Join Date:
Feb 2006
Location:
Boise, ID
Posts:
330
Plugin Contributions:
0

Re: Set a flat shipping cost for a single item

so copy the bit of code you say and change the products_status to use
TEXT_PRODUCT_IS_ALWAYS_FREE_SHIPPING from the product.php page ?

28 Mar 2012, 6:16 AM
#11
gloerick avatar

gloerick

Zen Follower

Join Date:
Feb 2006
Location:
Boise, ID
Posts:
330
Plugin Contributions:
0

Re: Set a flat shipping cost for a single item

I followed that to find product_is_always_free_shipping in the collect_info.php file..

so that will be the line to use for the change of the product_status either a 1 or 0, right ?

28 Mar 2012, 6:22 AM
#12
gloerick avatar

gloerick

Zen Follower

Join Date:
Feb 2006
Location:
Boise, ID
Posts:
330
Plugin Contributions:
0

Re: Set a flat shipping cost for a single item

ok trying

<?php if ($products->fields['product_is_always_free_shipping'] == '1') { echo '<a href="' . zen_href_link(FILENAME_CATEGORIES, 'action=setflag&flag=0&pID=' . $products->fields['products_id'] . '&cPath=' . $cPath . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '')) . '">' . zen_image(DIR_WS_IMAGES . 'free_shipping_set.png', IMAGE_ICON_STATUS_ON) . '</a>'; } else { echo '<a href="' . zen_href_link(FILENAME_CATEGORIES, 'action=setflag&flag=1&pID=' . $products->fields['products_id'] . '&cPath=' . $cPath . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '')) . '">' . zen_image(DIR_WS_IMAGES . 'icon_red_on.gif', IMAGE_ICON_STATUS_OFF) . '</a>'; } ?>

and in the categories I am trying :

  break;
  case 'setflag':
  if ( ($_GET['flag'] == '0') || ($_GET['flag'] == '1') ) {
    if (isset($_GET['pID'])) {
      zen_set_product_status($_GET['pID'], $_GET['flag']);
    
    }
  }
break;
 case 'setflag':
  if ( ($_GET['flag'] == '0') || ($_GET['flag'] == '1') ) {
    if (isset($_GET['pID'])) {
      zen_set_product_is_always_free_shipping($_GET['pID'], $_GET['flag']);

    }
  }
28 Mar 2012, 6:27 AM
#13
gloerick avatar

gloerick

Zen Follower

Join Date:
Feb 2006
Location:
Boise, ID
Posts:
330
Plugin Contributions:
0

Re: Set a flat shipping cost for a single item

well I got my little trucks, looks funny, as I need to find where the lable status is writen uptop and add free shipping next to it to line it up,
and when I click the truck the caegories shifts and I lose all the edit, move, attrib icons is close I think though.

Hope this is also helping anyone out there, trying to write down what I am doing, would be shorter if I was not trial and error.

28 Mar 2012, 6:29 AM
#14
gloerick avatar

gloerick

Zen Follower

Join Date:
Feb 2006
Location:
Boise, ID
Posts:
330
Plugin Contributions:
0

Re: Set a flat shipping cost for a single item

messed something up as the products that are linked and have the yellow status for it, those items are showing red,green and yellow all at the same time.

28 Mar 2012, 6:36 AM
#15
gloerick avatar

gloerick

Zen Follower

Join Date:
Feb 2006
Location:
Boise, ID
Posts:
330
Plugin Contributions:
0

Re: Set a flat shipping cost for a single item

ok, I put the category_product_listing.php code in the table
and cleared up the look of it, but now clicking the truck it triggering the disable product link and turning off the item from showing in the cart. so must just be a call to the wrong item,

and when clicking the truck all the other icons are gone until I start again by going to the categories from the top menu to get them back.

but now I have :

<td class="dataTableContent" width="50" align="left"> <?php if ($products->fields['product_is_always_free_shipping'] == '1') { echo '<a href="' . zen_href_link(FILENAME_CATEGORIES, 'action=setflag&flag=0&pID=' . $products->fields['products_id'] . '&cPath=' . $cPath . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '')) . '">' . zen_image(DIR_WS_IMAGES . 'free_shipping_set.png', IMAGE_ICON_STATUS_ON) . '</a>'; } else { echo '<a href="' . zen_href_link(FILENAME_CATEGORIES, 'action=setflag&flag=1&pID=' . $products->fields['products_id'] . '&cPath=' . $cPath . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '')) . '">' . zen_image(DIR_WS_IMAGES . 'icon_red_on.gif', IMAGE_ICON_STATUS_OFF) . '</a>'; } ?> </td>
28 Mar 2012, 6:49 AM
#16
gloerick avatar

gloerick

Zen Follower

Join Date:
Feb 2006
Location:
Boise, ID
Posts:
330
Plugin Contributions:
0

Re: Set a flat shipping cost for a single item

for the header to say free shipping I search for
TABLE_HEADING_STATUS

and copied right next to it and renamed to my new
TABLE_HEADING_SHIPPING I setup in /includes/lang/english/categories.php
to look like

<td class="dataTableHeadingContent" width="50" align="center"><?php echo TABLE_HEADING_STATUS; ?></td> <td class="dataTableHeadingContent" width="50" align="center"><?php echo TABLE_HEADING_SHIPPING; ?></td>
28 Mar 2012, 6:52 AM
#17
gloerick avatar

gloerick

Zen Follower

Join Date:
Feb 2006
Location:
Boise, ID
Posts:
330
Plugin Contributions:
0

Re: Set a flat shipping cost for a single item

so under the main products page from the top menu it looks funny as a space for the new

<td class="dataTableHeadingContent" width="50" align="center"><?php echo TABLE_HEADING_STATUS; ?></td> <td class="dataTableHeadingContent" width="50" align="center"><?php echo TABLE_HEADING_SHIPPING; ?></td>

needs to be made, but when you go under a main category the space appers there and the page looks normal.

28 Mar 2012, 7:03 AM
#18
gloerick avatar

gloerick

Zen Follower

Join Date:
Feb 2006
Location:
Boise, ID
Posts:
330
Plugin Contributions:
0

Re: Set a flat shipping cost for a single item

the main products page categorie/products is missing part of the bigger table so all the icons for editing on the far right are under sort and the sort numbers are now under the new free shipping title, so just need to find WHERE to add to the table for the editing icons to shove them right and be back under the title action.

28 Mar 2012, 7:15 AM
#19
gloerick avatar

gloerick

Zen Follower

Join Date:
Feb 2006
Location:
Boise, ID
Posts:
330
Plugin Contributions:
0

Re: Set a flat shipping cost for a single item

got the 1st page categories format :

in the category_product_listing.php "where most of all the editing is done" search for

<td class="dataTableContent" align="right"><?php echo $categories->fields['sort_order']; ?></td>

around line 175 and simple add the other needed colume

<td class="dataTableContent" align="right"></td>

right ABOVE the searched for line so it is in the proper place,

hint turn the table borders to 1, one at a time until you find the right table.

<td valign="top"><table border="1" width="100%" cellspacing="0" cellpadding="2"> <tr class="dataTableHeadingRow"> <?php if ($action == '') { ?>
28 Mar 2012, 7:17 AM
#20
gloerick avatar

gloerick

Zen Follower

Join Date:
Feb 2006
Location:
Boise, ID
Posts:
330
Plugin Contributions:
0

Re: Set a flat shipping cost for a single item

last item is clicking the status on/off for shipping and not the product, as right now the truck icon is doing just that.