A A A

Please consider registering
guest

Log In Register

Login form protected by Login LockDown.


Register | Lost password?
Advanced Search:

— Forum Scope —



— Match —



— Forum Options —




Wildcard usage:
*  matches any number of characters    %  matches exactly one character

Minimum search word length is 4 characters - maximum search word length is 84 characters

Topic RSS
Change How Shipping Accrues
January 9, 2011
4:44 pm
Member
Forum Posts: 4
Member Since:
August 9, 2010
Offline

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.'" />';
	} 


January 9, 2011
5:40 pm
Member
Forum Posts: 26
Member Since:
November 11, 2010
Offline

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!

January 9, 2011
6:36 pm
Member
Forum Posts: 26
Member Since:
November 11, 2010
Offline

Thanks nhknittingmama,

that works great! Now I have to go back through all my product posts to update accordingly, as I now need to add standard/priority/international.

 

Again thanks for the great fix, works just like I need it to.

January 9, 2011
6:41 pm
Member
Forum Posts: 26
Member Since:
November 11, 2010
Offline

Okay, now the next step for this; I have come up against different priority rates for the different zones due to using a different size box than flat rate USPS boxes. Do we have a way to determine shipping by zip code? Or would that only be available through Paypal shipping?

January 10, 2011
7:37 pm
Member
Forum Posts: 4
Member Since:
August 9, 2010
Offline

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!

June 20, 2011
4:33 pm
Member
Forum Posts: 26
Member Since:
November 11, 2010
Offline

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!

September 4, 2011
6:08 pm
Member
Forum Posts: 14
Member Since:
February 25, 2011
Offline

Hi

Can somebody please help me implement the above mod into the latest version of Market Theme (v4.28), the code is differnet in the latest cart.php file.

Thanks

John

September 14, 2011
1:28 am
Admin
Forum Posts: 5051
Member Since:
March 16, 2008
Offline

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.

Forum Timezone: UTC 0

Most Users Ever Online: 40

Currently Online:
21 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

icy1: 2371

wreed06: 175

laurie390: 168

StitchTek Services, LLC: 144

boutiqueelliette: 130

yiorgos: 127

Member Stats:

Guest Posters: 428

Members: 2252

Moderators: 1

Admins: 1

Forum Stats:

Groups: 1

Forums: 4

Topics: 2983

Posts: 16042

Moderators: Market Admin (5051)

Administrators: Market Admin (5051)

Market takes e-commerce to the next level with an easy to use, quick setup platform. Learn more or take the tour.