Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

per item math - charge$10 per every 3 items - will it work?


spencermjax

Recommended Posts

This is my shipping costs:

1-3 items - $10.00

4-6 items - $20.00

7-9 items - $30.00

etc...

 

Using the per item will not quite work for me because I am using an even number shipping amount per odd number of items.

In the per item shipping module I think this is the code I need to modify:

'cost' => (MODULE_SHIPPING_ITEM_COST * $total_count) + MODULE_SHIPPING_ITEM_HANDLING)));

 

I had a javascript cart once that I had shipping calculated like this:

((Math.ceil(fItems/3 ))*10);

 

Will this work:

'cost' => (MODULE_SHIPPING_ITEM_COST * (Math.ceil($total_count/3 ))*10) + MODULE_SHIPPING_ITEM_HANDLING)));

Link to comment
Share on other sites

did it again...posted without really trying on my own first.

Sorry!

PHP does not use Math.ceil() like javascript. All that is needed is ceil()

 

This is now my modification and it works:

'cost' => (MODULE_SHIPPING_ITEM_COST * (ceil($total_count/3 ))) + MODULE_SHIPPING_ITEM_HANDLING)));

Edited by spencermjax
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...