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
Adding shipping price for each item
April 2, 2008
3:19 pm
Admin
Forum Posts: 5051
Member Since:
March 16, 2008
Offline

Open up single.php. Find the area that looks like this:

<?php if (have_posts()) : while (have_posts()) : the_post(); // check for product thumbs
$thumb = get_post_meta($post->ID, 'pi1', $single = true); // check for product thumbs
$thumb2 = get_post_meta($post->ID, 'pi2', $single = true); // check for product thumbs
$thumb3 = get_post_meta($post->ID, 'pi3', $single = true); // check for product large image
$pli = get_post_meta($post->ID, 'pli', $single = true); // check for item price
$price = get_post_meta($post->ID, 'price', $single = true); // check items specs
$specs = get_post_meta($post->ID, 'specs', $single = true); ?>

Add the following so it looks like this (new addition is in bold)

<?php if (have_posts()) : while (have_posts()) : the_post(); // check for product thumbs
$thumb = get_post_meta($post->ID, 'pi1', $single = true); // check for product thumbs
$thumb2 = get_post_meta($post->ID, 'pi2', $single = true); // check for product thumbs
$thumb3 = get_post_meta($post->ID, 'pi3', $single = true); // check for product large image
$pli = get_post_meta($post->ID, 'pli', $single = true); // check for item price
$price = get_post_meta($post->ID, 'price', $single = true); // check items specs
$specs = get_post_meta($post->ID, 'specs', $single = true); // check item shipping
$shipping = get_post_meta($post->ID, 'shipping', $single = true);
?>

Now head toward the bottom of single.php…

You will see a div with a class of “buy”, then a form code. Right after the line

<input type=”hidden” name=”amount” value=”<?php echo $price; ?>”>

Add the line:

<input type=”hidden” name=”shipping” value=”<?php echo $shipping; ?>”>

Now
use a custom field called “shipping” to set the shipping price (just
like you do for the price custom field) for each item, i.e. 5.00.

May 4, 2008
10:55 pm
Member
Forum Posts: 73
Member Since:
May 4, 2008
Offline

How do you make it so that I can add shipping for items in my paypal account so that I can make it so that if you order 1-3 items it's $5 and 4-8 is $10 and so on.

Thanks,

Bruce

Wooden Cotton .com
May 5, 2008
10:19 pm
Member
Forum Posts: 73
Member Since:
May 4, 2008
Offline

More importantly actually, how do I make it so it adds $7 or whatever per order for shipping? Should be an easy fix, but I don't know how here

Wooden Cotton .com
May 23, 2008
7:26 pm
New Member
Forum Posts: 2
Member Since:
March 22, 2008
Offline

How would you add shipping options — for example, my items costs:

$5 for domestic, USPS

$13 for domestic FedEX

$12 Europe, ground

$18 Europe, DHL

$16 Japan, ground

$23 Japan, DHL

etc.

First step is to build a custom field for each. Next step is to return them to the page as an array of radio buttons, instead of hidden fields.

But how do I make the script only pick up and pass the selected one?

Thanks

Ro

May 24, 2008
6:54 am
Admin
Forum Posts: 5051
Member Since:
March 16, 2008
Offline

@Ro -

I've been able to do this for the standard “buy now” button, but I've had no such luck yet with the add to cart button because that is already using javascript, which is creating a conflict of the javascript used to submit shipping prices.

To setup shipping prices for the buy now button:

Open up single.php and add this under get the header..

<script type=”text/javascript”>
<!–
function Dollar (val) { // force to valid dollar amount
var str,pos,rnd=0;
if (val < .995) rnd = 1; // for old Netscape browsers
str = escape (val*1.0 + 0.005001 + rnd); // float, round, escape
pos = str.indexOf (”.”);
if (pos > 0) str = str.substring (rnd, pos + 3);
return str;
}

function SetShip (obj1) { // record selected shipping option
var j,obj,pos,tok,val,txt;
var ary = new Array ();
obj = obj1.shp; // refer to shipping select
pos = obj.selectedIndex; // get selection
if (pos == 0) { // force a selection
alert (”Make a shipping selection!”);
return false;
}
obj1.handling.value = “0″;
obj1.handling_cart.value = “0″;
obj1.shipping.value = “0″;
obj1.shipping2.value = “0″;
val = obj.options[pos].value; // selected value
txt = obj.options[pos].text; // the text value
ary = val.split (” “); // break apart
for (j=0; j<ary.length; j++) { // look at all items
// do 3-character tokens…
if (ary[j].length < 4) continue;
tok = ary[j].substring (0,3); // first 3 chars
val = ary[j].substring (3); // get data
if (tok == “hn=”) // value for item handling
obj1.handling.value = val;
if (tok == “hc=”) // value for handling cart
obj1.handling_cart.value = val;
if (tok == “s1=”) // value for shipping
obj1.shipping.value = val;
if (tok == “s2=”) // value for shipping2
obj1.shipping2.value = val;
}
obj1.os0.value = txt; // stuff the text into options field
}
//–>
</script>

Now find the div “buy”. Replace the entire first “form” with this new form code..

<form class=”lsf” action=”https://www.paypal.com/cgi-bin/webscr” method=”post” onsubmit=”this.target='paypal';
return SetShip (this);”>
<input type=”hidden” name=”cmd” value=”_xclick”>
<input type=”hidden” name=”business” value=”<?php bloginfo('admin_email'); ?>”>
<input type=”hidden” name=”item_name” value=”<?php the_title(); ?>”>
<input type=”hidden” name=”amount” value=”<?php echo $price; ?>”>
<input type=”hidden” name=”handling” value=”" />
<input type=”hidden” name=”handling” value=”" />
<input type=”hidden” name=”handling_cart” value=”" />
<input type=”hidden” name=”shipping” value=”" />
<input type=”hidden” name=”shipping2″ value=”0″ />
<input type=”hidden” name=”on0″ value=”Shipping” />
<input type=”hidden” name=”os0″ value=”" />
<input type=”hidden” name=”return” value=”<?php bloginfo('url'); ?>”>
<input type=”hidden” name=”cancel_return” value=”<?php bloginfo('url'); ?>”>
<input type=”hidden” name=”no_note” value=”1″>
<input type=”hidden” name=”currency_code” value=”USD”>
<input type=”hidden” name=”lc” value=”US”>
<input type=”hidden” name=”bn” value=”PP-BuyNowBF”>
<table>
<tr> <?php if (!empty($size)){

echo “

<td><input type=\\”hidden\\” name=\\”on0\\” value=\\”Size\\”/>

Size:</td>

<td><select name=\\”os0\\” class=\\”field\\” >

<option value=\\”$sizelist[0]\\”>$sizelist[0]</option>”;

if (isset($sizelist[1])) { echo “<option value=\\”$sizelist[1]\\”>$sizelist[1]</option>”; }

if (isset($sizelist[2])) { echo “<option value=\\”$sizelist[2]\\”>$sizelist[2]</option>”; }

if (isset($sizelist[3])) { echo “<option value=\\”$sizelist[3]\\”>$sizelist[3]</option>”; }

if (isset($sizelist[4])) { echo “<option value=\\”$sizelist[4]\\”>$sizelist[4]</option>”; }

if (isset($sizelist[5])) { echo “<option value=\\”$sizelist[5]\\”>$sizelist[5]</option>”; }

if (isset($sizelist[6])) { echo “<option value=\\”$sizelist[6]\\”>$sizelist[6]</option>”; }

if (isset($sizelist[7])) { echo “<option value=\\”$sizelist[7]\\”>$sizelist[7]</option>”; }

if (isset($sizelist[8])) { echo “<option value=\\”$sizelist[8]\\”>$sizelist[8]</option>”; }

if (isset($sizelist[9])) { echo “<option value=\\”$sizelist[9]\\”>$sizelist[9]</option>”; }

if (isset($sizelist[10])) { echo “<option value=\\”$sizelist[10]\\”>$sizelist[10]</option>”; }

echo ” </select>

</td>”; } ?>

</tr>

<tr>

<td><?php if (!empty($color)){

echo “<input type=\\”hidden\\” name=\\”on1\\” value=\\”Color\\”/>

Color:</td>

<td><select name=\\”os1\\” class=\\”field\\”>

<option value=\\”$colorlist[0]\\”>$colorlist[0]</option>”;

if (isset($colorlist[1])) { echo “<option value=\\”$colorlist[1]\\”>$colorlist[1]</option>”; }

if (isset($colorlist[2])) { echo “<option value=\\”$colorlist[2]\\”>$colorlist[2]</option>”; }

if (isset($colorlist[3])) { echo “<option value=\\”$colorlist[3]\\”>$colorlist[3]</option>”; }

if (isset($colorlist[4])) { echo “<option value=\\”$colorlist[4]\\”>$colorlist[4]</option>”; }

if (isset($colorlist[5])) { echo “<option value=\\”$colorlist[5]\\”>$colorlist[5]</option>”; }

if (isset($colorlist[6])) { echo “<option value=\\”$colorlist[6]\\”>$colorlist[6]</option>”; }

if (isset($colorlist[7])) { echo “<option value=\\”$colorlist[7]\\”>$colorlist[7]</option>”; }

if (isset($colorlist[8])) { echo “<option value=\\”$colorlist[8]\\”>$colorlist[8]</option>”; }

if (isset($colorlist[9])) { echo “<option value=\\”$colorlist[9]\\”>$colorlist[9]</option>”; }

if (isset($colorlist[10])) { echo “<option value=\\”$colorlist[10]\\”>$colorlist[10]</option>”; }

echo “

</select>

</td>”; } ?>

</tr>

<tr>
<td>Shipping:</td>
<td><select name=”shp” class=”field”>
<option>Select Shipping</option>
<option value=”s1=1.00″>Normal $1.00</option>
<option value=”s1=2.00″>Two days $2.00</option>
<option value=”s1=3.00″>Overnight $3.00</option>
</select>
</td>
</tr>

</table>

<input type=”image” src=”<?php bloginfo('template_directory'); ?>/imgs/bn.gif” class=”pp” border=”0″ name=”submit” alt=”Make payments with PayPal – it's fast, free and secure!”>
</form>

Now, as you can see, you can edit / add / remove the options for shipping. Those are just examples. The “value” is going to be the price. Now if you are going to have flat rate shipping for all of the items, just defining them once in the actual template will work the best.

If you will be having different shipping prices for each item and each shipping type, it's best to use custom fields. It would work like so…

<option value=”s1=<?php echo $ship1; ?>”>Normal $<?php echo $ship1; ?></option>
<option value=”s1=<?php echo $ship2; ?>”>Two days $<?php echo $ship2; ?></option>
<option value=”s1=<?php echo $ship3; ?>”>Overnight $<?php echo $ship3; ?></option>

Chances are you will offer the same kind of shipping items, but the price will differ for each item. Therefore just copy over each option field, adjust the shipping type / name, and then set the price using custom fields in the write / add product screen. For example, use a custom field named “ship1″ with a vlue of 2.50, etc.

August 11, 2008
5:38 pm
Member
Forum Posts: 11
Member Since:
July 21, 2008
Offline

So all that in the last post, is that just for the 'Buy now' button?

I really need to have local and international shipping prices for each of my products, or else I'm out of pocket every time someone buys one of my books from overseas. I'd prefer to use the cart — or else why use the theme, and not just a pre-rolled PayPal button?

The solution in this thread would do the trick:

http://www.markettheme.com/for…..ons/page-1

…but I suspect it's for a previous version of the cart.

I'd appreciate any help you can offer in setting this up. Thanks.

November 21, 2008
4:10 pm
Admin
Forum Posts: 5051
Member Since:
March 16, 2008
Offline

Here's another post that relates a little to this one

http://www.markettheme.com/for…..pal/page-1

December 3, 2008
4:20 pm
Admin
Forum Posts: 5051
Member Since:
March 16, 2008
Offline

Hamish,

Sorry, but right now Market doesn't have a built-in way for setting multiple shipping amounts (domestic vs. international).  It only allows the 1 shipping price.

However, a new update is currently in the works to give Market this multi-shipping rate ability.  The update is still a few weeks out, so there's nothing available right now other than the Paypal method in the post link above. 

When the update is finished and available for download, I will send out a message to everybody to let them know they can find it in the download center.

June 3, 2009
2:04 pm
Member
Forum Posts: 9
Member Since:
January 27, 2009
Offline

Okay…I'm sorting through all the FAQ's and postings, and have yet to find a solution to our more immediate challenge:

On any given item, we'd like to list 4 shipping options (USPS/UPS Ground/UPS 2nd Day/UPS Next Day) & International (not as pressing). Using the standard template, three options display as "Standard/Priority/International".

Is this fix been identified? TIA

June 3, 2009
4:24 pm
Admin
Forum Posts: 5051
Member Since:
March 16, 2008
Offline
10

For using 3 shipping methods, all you really need to do is change the text from "Standard, Priority, International" to whatever text you desire (ie. USPS, UPS Ground, UPS 2nd Day, etc.)

In order to have more than 3 choices in the dropdown box, you'll need to add a few lines of code.

Open "single.php" for editing.  

(These changes are for Market version 3.451 by the way)

Scroll down to around line # 135 through 137 to the lines:

            if (isset($shipping[0]) && $shipping[0]!="") { echo "<option value=\\"$shipping[0]\\">Standard ($".$shipping[0].")</option>"; }
            if (isset($shipping[1]) && $shipping[1]!="") { echo "<option value=\\"$shipping[1]\\">Priority ($".$shipping[1].")</option>"; }
            if (isset($shipping[2]) && $shipping[2]!="") { echo "<option value=\\"$shipping[2]\\">International ($".$shipping[2].")</option>"; }

To simply change the text, change the words "Standard", "Priority", and "International" to whatever you want your options to be.

To add additional options, copy the last line and paste it immediately after the last line.  Then go through and change "2" to "3".  (change to "4" for the next, "5" for the next, etc.)  It goes up incrementally by 1.

So, if you were to add 2 additional options, your resulting code would be:

            if (isset($shipping[0]) && $shipping[0]!="") { echo "<option value=\\"$shipping[0]\\">Standard ($".$shipping[0].")</option>"; }
            if (isset($shipping[1]) && $shipping[1]!="") { echo "<option value=\\"$shipping[1]\\">Priority ($".$shipping[1].")</option>"; }
            if (isset($shipping[2]) && $shipping[2]!="") { echo "<option value=\\"$shipping[2]\\">International ($".$shipping[2].")</option>"; }           
            if (isset($shipping[3]) && $shipping[3]!="") { echo "<option value=\\"$shipping[3]\\">extra choice #1 ($".$shipping[3].")</option>"; }
            if (isset($shipping[4]) && $shipping[4]!="") { echo "<option value=\\"$shipping[4]\\">extra choice #2 ($".$shipping[4].")</option>"; }

The above changes are for the "Buy Now" button option.   You will also need to perform this task for the "Add to Cart" button option.

So, scroll down further to around lines 202 – 204 and find the code:

            if (isset($shipping[0]) && $shipping[0]!="") {if (isset($shipping2[0]) && $shipping2[0]!="") {$cartship[0].="/".$shipping2[0];}echo "<option value=\\"$cartship[0]\\">Standard ($".$shipping[0].")</option>"; }
            if (isset($shipping[1]) && $shipping[1]!="") {if (isset($shipping2[1]) && $shipping2[1]!="") {$cartship[1].="/".$shipping2[1];}echo "<option value=\\"$cartship[1]\\">Priority ($".$shipping[1].")</option>"; }
            if (isset($shipping[2]) && $shipping[2]!="") {if (isset($shipping2[2]) && $shipping2[2]!="") {$cartship[2].="/".$shipping2[2];}echo "<option value=\\"$cartship[2]\\">International ($".$shipping[2].")</option>"; }

 In a similar fashion as you did above, copy the last line and paste it after the last line for the number of additional items you want to have.  Make sure to change the incremental variable number for each additional one.

So, continuing our example of adding two, the resulting code would be:

            if (isset($shipping[0]) && $shipping[0]!="") {if (isset($shipping2[0]) && $shipping2[0]!="") {$cartship[0].="/".$shipping2[0];}echo "<option value=\\"$cartship[0]\\">Standard ($".$shipping[0].")</option>"; }
            if (isset($shipping[1]) && $shipping[1]!="") {if (isset($shipping2[1]) && $shipping2[1]!="") {$cartship[1].="/".$shipping2[1];}echo "<option value=\\"$cartship[1]\\">Priority ($".$shipping[1].")</option>"; }
            if (isset($shipping[2]) && $shipping[2]!="") {if (isset($shipping2[2]) && $shipping2[2]!="") {$cartship[2].="/".$shipping2[2];}echo "<option value=\\"$cartship[2]\\">International ($".$shipping[2].")</option>"; }
            if (isset($shipping[3]) && $shipping[3]!="") {if (isset($shipping2[3]) && $shipping2[3]!="") {$cartship[3].="/".$shipping2[3];}echo "<option value=\\"$cartship[3]\\">extra choice #1 ($".$shipping[3].")</option>"; }
            if (isset($shipping[4]) && $shipping[4]!="") {if (isset($shipping2[4]) && $shipping2[4]!="") {$cartship[4].="/".$shipping2[4];}echo "<option value=\\"$cartship[4]\\">extra choice #2 ($".$shipping[4].")</option>"; }

Save the file, and that will complete the coding changes.

To enter the data now, you'll simplly use the Product manager as you have been for shipping rates — however you will enter 2 additional values.  (with slashes inbetween)

So, instead of entering "4.00/6.00/8.00" you would now enter 2 additional values. 

"4.00/6.00/8.00/12.00/15.00"

Make sure to enter the data for both the Base unit cost, and the additional unit rates.

Forum Timezone: UTC 0

Most Users Ever Online: 40

Currently Online:
20 Guest(s)

Currently Browsing this Page:
2 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.