Topic RSS
My company only ships one thing, which is skeins of yarn. I was looking for a way to change the shipping options so that it only charged the full shipping rate on the first skein of yarn, then the additional piece charge for every skein after that. Each time I would add a different item to the cart it would charge the full price for the first one, even if I had other skeins already in the cart.
I couldn't find anything here on how to make it work like that so I started looking at the cart.php file and realized that the code looked very similar to Java. That was fortuitous for me because I just finished taking a Java class. So, I rewrote part of the code so that it would do what I needed it to, checked the code syntax against the Docs over at php.net and now my cart works as it should! I wanted to share the code in case anyone needs a similar shipping structure.
To recap what this does, the "Base Shipping Cost" will be applied to "Quantity 1" of the items in your cart. After that, each additional piece, no matter if they add more of the same item or choose a different one, will have the "Shipping Cost for Each Additional Unit" applied.
(ADMIN NOTE: Just a heads up… Lines #3 and 4 below are both meant to be on the same line. It had to be cut into 2 lines because of word wrapping of the text.)
//Monolithic display cart function function ShowCart($crtName,$crtPostID,$crtAmount,$crtQuantity,$crtStockQuantity,$crtShipping, $crtShipping2,$crtHandling,$crtHandlingCart,$crtOptions,$PPOptions){ include("cart_top.php"); global $CARTURL,$CURRENCY_SYMBOL,$ACTION_URL,$CHECKOUT_RETURNURL,$CARTDIR; $checkout = ''; $prods = ''; $i = 1; $ShippingTotal = 0; $GrandTotal = 0; $FirstItem = 0; foreach( $crtAmount as $item =>$amount ){ $Shipping = 0; if ($crtShipping[$item]){ if ($FirstItem == 0){ $Shipping = $crtShipping[$item] + ($crtShipping2[$item] * ($crtQuantity[$item] - 1)); $FirstItem = 1; } else { $Shipping += $crtShipping2[$item] * ($crtQuantity[$item]); } $checkout .='<input type= "hidden" name="shipping_'.$i.'" value="'.$Shipping.'" />'; }
Hi,
That was the question I just posed in an earlier thread! I am a yarn dyer too and was having the same problem. I found an old post that had a way to change the code to add a base shipping cost for each order and then the additional item charge would be the individual posts shipping cost. When I pasted in the new code I then got a syntax error. I have been fussing with it all weekend and have not been able to fix it. I am very new to code; as a graphic designer I just used programs that were WYSIWYG!
I am going to try your code to see if this works!
I am so glad that someone found use in my code! It is simple code, but it took me a few hours of looking at the different pages and at the documents on PHP coding to figure it out. It's funny that another Yarnie found this and used it.
The shipping in Market Theme is pretty basic as you can see, hence the need for modified code. Doing the shipping zones through PayPal Shipping is going to be your best bet unless you want to hire someone who is fluent in PHP to write something custom for you.
Best of Luck!
Hi,
I have upgraded to 4.25 and have the checkout process working how I need it to with Paypal and Authorize.net. However, I had made the above changes to my cart.php files that obviously disappeared when I upgraded. I need to rewrite the code to have the shipping charges accrue as in the above change, but the current 4.25 file looks like it has much more code in it than the 4.1 file that I modified. I am not a programmer so I would appreciate some direction as to modifying the current file with the above changes.
Thanks!
Try reading this thread:
http://www.markettheme.com/for…..rst/page-2
starting at post #39.
You'll set a base shipping cost there, and then make all of your product specific shipping costs equal to zero.
This will create a base rate shipping for an order, regardless of the number of items ordered.
Most Users Ever Online: 40
Currently Online:
21 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Member Stats:
Guest Posters: 428
Members: 2252
Moderators: 1
Admins: 1
Forum Stats:
Groups: 1
Forums: 4
Topics: 2983
Posts: 16042
Newest Members: Allsed, deleteduser, shanm, slidesketch, jimharrison, vmi
Moderators: Market Admin (5051)
Administrators: Market Admin (5051)

Log In
Register
Home
Offline

