Jump to content


Corporate Sponsors


Latest News: (loading..)

* * * * * 2 votes

[contribution] individual product shipping prices


730 replies to this topic

#1 dmGremlin

  • Community Member
  • 68 posts
  • Real Name:D. M. Gremlin
  • Location:Long Beach, CA

Posted 07 July 2003, 01:00

I've just successfully tested this mod I've been working on - it's kind of like the other contribution by this name found here http://www.oscommerce.com/community/contributions,367 except with this one, I've created a separate database table to hold individual shipping prices that you can modify in your admin like any other product variable - which means you can keep your 'weight' field and use this contribution with any other shipping modules... such as 'multi vendor shipping' if you were so inclined.

If there's enough interest for this, I'll go ahead and package it as a contribution and upload it.
-D. M. 8)

#2 MikeMike

  • Community Member
  • 153 posts
  • Real Name:Michael

Posted 07 July 2003, 12:17

Maybe it could help me.

I use UPS shipping for all my products, but I want to sell my printed product catalog without any shipping charges.
Will I be able to do this with your code?
Will it only use the individual shipping price if I have typed something in the individuel shipping rate field, and use the usual shipping calculation if the field is empty?

Regards
Michael

#3 dmGremlin

  • Community Member
  • 68 posts
  • Real Name:D. M. Gremlin
  • Location:Long Beach, CA

Posted 07 July 2003, 16:22

It sounds like for what you're doing, you would just need multi-vendor shipping. You would punch in a code in your product-edit screen to choose what kind of shipping method you would want... free or ups.

A mod like mine is only useful if you need individual set prices on each product. If you only need either UPS or free shipping, try multi-vendor.
-D. M. 8)

#4 Farrukh

  • Community Member
  • 480 posts
  • Real Name:Farrukh Saeed

Posted 07 July 2003, 19:19

I would like this contribution.

I have selling some products and the manufacturers have different rates of shipping and I have different.

Would I be able to set different Shipping rates along with the specified Zones.

#5 Farrukh

  • Community Member
  • 480 posts
  • Real Name:Farrukh Saeed

Posted 07 July 2003, 19:21

Can you post it as a Contribution. I would like to try it out

#6 dmGremlin

  • Community Member
  • 68 posts
  • Real Name:D. M. Gremlin
  • Location:Long Beach, CA

Posted 08 July 2003, 04:30

Ok, here it is:

http://www.oscommerce.com/community/contributions,1333

Be nice everyone, this is my first contribution. Let me know how it works for you.
-D. M. 8)

#7 Genius

  • Community Member
  • 503 posts
  • Real Name:Prash

Posted 08 July 2003, 10:47

HI,

Your contribution, on shipping per price.. would this criteria work... Say i and a price for each of the products, now say if one has to buy 2 of the same products can the second product be at a lower price...


what i need it, the shipping cost of the first product is higher than the additional product, SO say

1st Group 1 prod. = 1.75 , any additional prod = 0.40
1st Group 2 prod. = 0.90 , any additional prod. = 0.20

So if i buy 2x group 1 my shipping should be 1.75+0.40 = 2.15
if i buy 1x group1 and 1xgroup 2 = 1.75+0.90 = 2.65

if buy 2xgroup 1 and 1 x group 2 then = 1.75+0.40+0.90 = 2.55
if buy 2xgroup 1 and 2 x group 2 then = 1.75+0.40+0.90+0.20= 2.75

etc.....


can that be done with your contrib.

#8 dmGremlin

  • Community Member
  • 68 posts
  • Real Name:D. M. Gremlin
  • Location:Long Beach, CA

Posted 08 July 2003, 17:03

No, it can't - but that's an interesting idea.

This only sets an individual price for each product, not modified by any quantity of that product.

It might be simple to make a mod, but you'd need to add a second field the same way as the first and then in the shopping cart.php do a modification like...

$this->shiptotal += ($products_ship_price);

if $qty => 1 {

$this->shiptotal += ($products_ship_price_two * qty);

}

and of course, add the second price to the above queries...

I.e. after

$products_ship_price = $product['products_ship_price'];

add

$products_ship_price_two = $product['products_ship_price_two'];

and then add products_ship_price_two where you added products_ship_price to the query under // products price

so, now that I think about it, yes - my contribution can do that... with those mods to shopping_cart.php - the price for one would be the original 'products_ship_price' and the cost for the each product more than one would be 'products_ship_price_two' - basically that would function exactly as you wanted...

...so of course you're going to have to add 'products_ship_price_two' to the database the same way you added "products_ship_price" - and install it to the admin/catalog.php the same way you installed the first database field.

Actually, now that I think about it, you could repeat this process into infinity, having as many price-by-quantity splits as you have patience for.

Hmm... Good idea. I hope this helps.
-D. M. 8)

#9 dmGremlin

  • Community Member
  • 68 posts
  • Real Name:D. M. Gremlin
  • Location:Long Beach, CA

Posted 08 July 2003, 21:12

one typo and an error in my math above.

it would have to be more like

$this->shiptotal += ($products_ship_price); 

if $qty => 1 { 

$this->shiptotal += ($products_ship_price_two * ($qty-1)); 

}

otherwise it would count one too many.

that should do it though.
-D. M. 8)

#10 dmGremlin

  • Community Member
  • 68 posts
  • Real Name:D. M. Gremlin
  • Location:Long Beach, CA

Posted 08 July 2003, 22:56

and that would be

if $qty > 1 {
instead of
if $qty => 1 {

and so on and so forth.. ahem
-D. M. 8)

#11 Genius

  • Community Member
  • 503 posts
  • Real Name:Prash

Posted 09 July 2003, 10:05

Hi,
thanks for the feedback i will try and let you know.. Just another question... do i need to make anychanges to the indvship.php files...

#12 Genius

  • Community Member
  • 503 posts
  • Real Name:Prash

Posted 09 July 2003, 10:27

About the Admin/catalog.php -- is not admin/caegories.php? do i have to add products_ship_price_two line to every code that has products_ship_price_two.

...so of course you're going to have to add 'products_ship_price_two' to the database the same way you added "products_ship_price" - and install it to the admin/catalog.php the same way you installed the first database field.

#13 Genius

  • Community Member
  • 503 posts
  • Real Name:Prash

Posted 09 July 2003, 11:11

FINALLY IT WORKS -BRILLIANT Contribution.....
thank you so much it.. it's a relief... i have it working.....

Though i must add that in the code
CODE:

if $qty > 1 {

YOu need to have it like this:

if ($qty > 1) {

Then it will work else you will get a error on the page..
My input to your contribute :lol: ( I'm a happy man)

#14 dmGremlin

  • Community Member
  • 68 posts
  • Real Name:D. M. Gremlin
  • Location:Long Beach, CA

Posted 09 July 2003, 17:33

You're most welcome, Genius! :) It sounds like you've got it all figured out, but just for the sake of the forums, yes - I did mean admin/categories.php instead of admin/catalog.php
-D. M. 8)

#15 Aric

  • Community Member
  • 24 posts
  • Real Name:Aric
  • Location:Windsor, Canada

Posted 09 July 2003, 22:59

Thanks so much for this contribution! Your timing was impeccable as I was about to give ProdRate a go. I visited the contribs section to make sure it was compatible with the version of osC that I had installed, and low and behold there was Indvship freshly added.

I can't comment on ProdRate as I never did install it, but your mod is exactly what I was looking for. Great documentation for ease of install. I'm new to osC and this contrib convinced me to go with it (if I couldn't get individual shipping prices, I would have had to look for another cart solution).

Thanks again!

#16 Farrukh

  • Community Member
  • 480 posts
  • Real Name:Farrukh Saeed

Posted 19 July 2003, 17:59

Hi dmGremlin

I have installed the contribution and it works great.

I would need to ask you one thing .

When I specify an Individual Shipping for a product, it comes along with the zones rates.

It shows both the Individual shipping and Zones Rates on Checkout_shipping.php

I would like to know as if its possible to use this with Zones Rates enabled.
For ex. If I specify an individual shipping for a product, it should Just use that individual shipping cost and leave out the Zone Rates cost.

Is this possible

#17 dmGremlin

  • Community Member
  • 68 posts
  • Real Name:D. M. Gremlin
  • Location:Long Beach, CA

Posted 19 July 2003, 22:29

you will need to use the multi vendor shipping contribution found here: http://www.oscommerce.com/community/contributions,969

to do what you're trying to do.
-D. M. 8)

#18 Aric

  • Community Member
  • 24 posts
  • Real Name:Aric
  • Location:Windsor, Canada

Posted 19 July 2003, 22:41

This contrib works just fine with MS2 with minor alterations.

You may want to update the instructions (install.wri) to reflect the changes :)

Example: (original install.wri)
-> Find



tep_db_query("insert into " . TABLE_PRODUCTS . " (products_quantity, products_model, products_image, products_price, products_date_added, products_date_available, products_weight, products_status, products_tax_class_id, manufacturers_id) values ('" . $product['products_quantity'] . "', '" . $product['products_model'] . "', '" . $product['products_image'] . "', '" . $product['products_price'] . "',  now(), '" . $product['products_date_available'] . "', '" . $product['products_weight'] . "', '0', '" . $product['products_tax_class_id'] . "', '" . $product['manufacturers_id'] . "')");



-> Change it to add products ship method (there are two changes). You do not want to just replace the line as it will interfere with any other mods you might have installed.



tep_db_query("insert into " . TABLE_PRODUCTS . " (products_quantity, products_model, /*changes indvship*/ products_ship_price, products_image, products_price, products_date_added, products_date_available, products_weight, products_status, products_tax_class_id, manufacturers_id) values ('" . $product['products_quantity'] . "', '" . $product['products_model'] . "', /*changes indvship*/ '" . $product['products_ship_price'] . "', '" . $product['products_image'] . "', '" . $product['products_price'] . "',  now(), '" . $product['products_date_available'] . "', '" . $product['products_weight'] . "', '0', '" . $product['products_tax_class_id'] . "', '" . $product['manufacturers_id'] . "')");

You'll notice in MS2 that all the values now use the function tep_db_input()

... so you're edit will look something like this:

            tep_db_query("insert into " . TABLE_PRODUCTS . " (products_quantity, products_model, /*changes indvship*/ products_ship_price, products_image, products_price, products_date_added, products_date_available, products_weight, products_status, products_tax_class_id, manufacturers_id) values ('" . tep_db_input($product['products_quantity']) . "', '" . tep_db_input($product['products_model']) . "', /*changes indvship*/ '" . tep_db_input($product['products_ship_price']) . "', '" . tep_db_input($product['products_image']) . "', '" . tep_db_input($product['products_price']) . "',  now(), '" . tep_db_input($product['products_date_available']) . "', '" . tep_db_input($product['products_weight']) . "', '0', '" . (int)$product['products_tax_class_id'] . "', '" . (int)$product['manufacturers_id'] . "')");

And secondly:

-> Find



            <td class="main"><?php echo TEXT_PRODUCTS_PRICE; ?></td>

            <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . '&nbsp;' . tep_draw_input_field('products_price', $pInfo->products_price); ?></td>

          </tr>



-> Add this right below the </tr> tag



<!-- mod indvship -->

<tr>

            <td class="main"><?php echo 'Indv. Shipping Price:'; ?></td>

            <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . '&nbsp;' . tep_draw_input_field('products_ship_price', $pInfo->products_ship_price); ?></td>

          </tr>

<!-- end indvship -->

You'll notice that you won't "find" the lines it tells you to find, because they are slightly different.

<td class="main"><?php echo TEXT_PRODUCTS_PRICE; ?></td>

does not exist in MS2.

Instead that section of code now looks like this:
          <tr bgcolor="#ebebff">

            <td class="main"><?php echo TEXT_PRODUCTS_TAX_CLASS; ?></td>

            <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . '&nbsp;' . tep_draw_pull_down_menu('products_tax_class_id', $tax_class_array, $pInfo->products_tax_class_id, 'onchange="updateGross()"'); ?></td>

          </tr>

          <tr bgcolor="#ebebff">

            <td class="main"><?php echo TEXT_PRODUCTS_PRICE_NET; ?></td>

            <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . '&nbsp;' . tep_draw_input_field('products_price', $pInfo->products_price, 'onKeyUp="updateGross()"'); ?></td>

          </tr>

          <tr bgcolor="#ebebff">

            <td class="main"><?php echo TEXT_PRODUCTS_PRICE_GROSS; ?></td>

            <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . '&nbsp;' . tep_draw_input_field('products_price_gross', $pInfo->products_price, 'OnKeyUp="updateNet()"'); ?></td>

          </tr>

Just add the code the instructions tell you to after all this :)

Do the "find" on:
<td class="main"><?php echo TEXT_PRODUCTS_PRICE

Your resulting code will look like this:
          <tr bgcolor="#ebebff">

            <td class="main"><?php echo TEXT_PRODUCTS_TAX_CLASS; ?></td>

            <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . '&nbsp;' . tep_draw_pull_down_menu('products_tax_class_id', $tax_class_array, $pInfo->products_tax_class_id, 'onchange="updateGross()"'); ?></td>

          </tr>

          <tr bgcolor="#ebebff">

            <td class="main"><?php echo TEXT_PRODUCTS_PRICE_NET; ?></td>

            <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . '&nbsp;' . tep_draw_input_field('products_price', $pInfo->products_price, 'onKeyUp="updateGross()"'); ?></td>

          </tr>

          <tr bgcolor="#ebebff">

            <td class="main"><?php echo TEXT_PRODUCTS_PRICE_GROSS; ?></td>

            <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . '&nbsp;' . tep_draw_input_field('products_price_gross', $pInfo->products_price, 'OnKeyUp="updateNet()"'); ?></td>

          </tr>

          

     <!-- mod indvship -->

   <tr>

     <td class="main"><?php echo 'Indv. Shipping Price:'; ?></td>

     <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . '&nbsp;' . tep_draw_input_field('products_ship_price', $pInfo->products_ship_price); ?></td>

   </tr>

   <!-- end indvship -->


#19 Elmo

  • Community Member
  • 195 posts
  • Real Name:Elmo

Posted 31 July 2003, 00:03

Hi D. M.! Thanks for sharing this contribution with us. I've been looking for a shipping contribution like this for a long time. I have a quick question! May I ask if I can use this module if I already installed "State Based Rates" module at

http://www.oscommerce.com/community/contri...ions,818/page,3 ?

Many thanks! :)

#20 mikeinbigfork

  • Community Member
  • 21 posts
  • Real Name:Mike Callaghan
  • Location:Bigfork, Montana, USA

Posted 31 July 2003, 03:50

Hi DM,

Thanks for taking the time to make this available. I would like to use this to assign a handling charge per product item rather than a shipping charge. And still assign either Weight, Zone, or Table rate based Shipping charges.

Can your contribution be used in this way, in combination with the other shipping modules to effectively provide Product based handling charges?

Thanks in advance,
Mike