Your account is limited to posting only in the Pre-Sales Questions forum.
Support forum access is limited to members with a purchase history.

If you are working on behalf of another member, please contact us with the name of the license holder and we will upgrade your account.
   
 
Special shipping setup: how to apply plugin rates to one set of products and not another
Posted: 29 June 2012 11:01 AM   [ Ignore ]
Wallflower
Rank
Total Posts:  10
Joined  2011-09-28

My client’s site primarily sells one type of item and the shipping plugin is a modified By Location - Quantity threshold. Now they are adding a different type of product that will need a flat rate per piece that doesn’t fit with the plugin. Can I set the rate for those items in the product entry and tell checkout not to get the rates for these from the plugin but use the rate manually entered (if shipping != ‘’)?

So… {if shipping} == ‘’} use the plugin rates, and if {if shipping != ‘’} use the shipping amount entered?

If I can do this, can you give me direction or example? Thanks!

Profile
 
 
Posted: 29 June 2012 01:49 PM   [ Ignore ]   [ # 1 ]
Administrator
Avatar
RankRankRankRankRank
Total Posts:  10256
Joined  2008-09-29

Best way would be to modify the shipping plugin. A standard by location quantity threshold plugin, you could change this line:

$total_items $this->core->cart->count_all(array('no_shipping' => FALSE)); 

 

to this:

$total_items 0
        
$per_item_shipping 0
        foreach (
$this->core->cart->shippable_items() as $row_id => $item)
        
{
            
if (!$item->shipping())
            
{
                $total_items 
++; 
            
}
            
else
            
{
                $per_item_shipping 
+= $item->shipping(); 
            
}
         } 

 

and at the end where it says

return $shipping

 

change to:

return $shipping $per_item_shipping

 

Basically that would let you set per-item shipping costs, while still using a cart-wide quantity threshold.

 Signature 

We’re moving away from the forums, though not entirely and not immediately. Lack of support lately is coincidental to that. Unfortunately we’ve had a bad month with it, but we do not forsee that we will have any continued problems with support through our portal going forward, or on forums while we’re still transitioning. We will send out a newsletter and make additional notifications through twitter and other outlets over the coming weeks.

Moving forward; things returning to normal.

Profile
 
 
Posted: 30 June 2012 12:56 PM   [ Ignore ]   [ # 2 ]
Wallflower
Rank
Total Posts:  10
Joined  2011-09-28

Thanks very much! This works perfectly—basically allowing 2 different categories of products to have shipping calculated in their own way.

Profile