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
1 product, 2 price options ...
May 14, 2008
5:32 pm
Member
Forum Posts: 10
Member Since:
April 3, 2008
Offline

I have products that are sold both "by the bag" and "by the box". The prices are different. So I need to set it up where the appropriate price is charged depending on the what the buyer selects.

I am using the "add to cart" FatFree option.

How would I impliment this ..?

May 14, 2008
6:16 pm
Admin
Forum Posts: 5051
Member Since:
March 16, 2008
Offline

With the FatFreeCart version…

Open up single.php (or singlesale.php, depending on your setup).

Find the following:

<?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); ?>

We'll add in one new line for the custom field "price2".

<?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 for item price2
$price2 = get_post_meta($post->ID, 'price2', $single = true); // check items specs
$specs = get_post_meta($post->ID, 'specs', $single = true); ?>

Now go down to where you see "End Vcart" code. Underneath paste the following chunk of code.

<?php // if there's a second item price
if($price2 !== '') { ?>

<!–Start Second Item Cart Code–>
<form action="https://www.e-junkie.com/ecom/fgb.php?c=cart&cl=1&ejc=2" target="ej_ejc" method="POST">
<!– paypal email(remove if not using PayPal) –>
<input type="hidden" name="business" value="<?php bloginfo('admin_email'); ?>"/>
<!– google merchant id (remove if not using Google Checkout) –>
<input type="hidden" name="merchant_id" value="your_google_merchant_id"/>
<!– site url –>
<input type="hidden" name="site_url" value="<?php bloginfo('url'); ?>"/>
<!– contact email (where we can notify of the updates) –>
<input type="hidden" name="contact_email" value="<?php bloginfo('admin_email'); ?>"/>
<!– item name –>
<input type="hidden" name="item_name" value="<?php the_title(); ?>"/>
<!– item number (should be different for each product)–>
<input type="hidden" name="item_number" value="<?php the_ID(); ?>"/>
<!– item price –>
<input type="hidden" name="amount" value="<?php echo $price; ?>"/>
<!– initial quantity –>
<input type="hidden" name="quantity" value="1"/>
<!– item options (can be removed if not required) –>
<table>
<tr>
<td><input type="hidden" name="on0" value="Size (if required)"/>
Size (if required)</td>
<td><select name="os0" class="field" >
<option value="S">S</option>
<option value="M">M</option>
<option value="L">L</option>
<option value="XL">XL</option>
</select>
</td>
</tr>
<tr>
<td><input type="hidden" name="on1" value="Color (if required)"/>
Color (if required)</td>
<td><select name="os1" class="field">
<option value="Red">Red</option>
<option value="White">White</option>
<option value="Blue">Blue</option>
<option value="Orange">Orange</option>
<option value="Tan">Tan</option>
</select>
</td>
</tr>
</table>
<!– Edit and uncomment these if you wish to include them. See http://www.fatfreecart.com/code.html for more info

<input type="hidden" name="shipping" value="1">
<input type="hidden" name="shipping2" value="0.5">
<input type="hidden" name="handling" value="0.5">
<input type="hidden" name="tax" value="0.50"/>

–>
<!– following options are applicable to whole cart–>
<!– you thank you page –>
<input type="hidden" name="return_url" value="<?php bloginfo('url'); ?>"/>
<!– any custom info you want to pass for the whole order –>
<input type="hidden" name="custom" value="anything"/>
<!– currency (USD for Google Checkout USA, GBP for Google Checkout UK. For PayPal: any currency that PayPal supports –>
<input type="hidden" name="currency_code" value="USD"/>
<input type="image" src="<?php bloginfo('template_directory'); ?>/imgs/addcart2.gif" border="0" onClick="javascript:return EJEJC_lc(this.parentNode);">
</form>
<!–End 2nd Cart Code–>

<?php } // end if statement

// if there's not a second price
else { echo ''; } ?>

What this will do is create a second add to cart button if you specify a second price. You will want to create a new image and put it in your images folder, calling it "addcart2.gif" Make sure the image defines the difference between the different add to cart options (in your case bag and box).

Now in your posts create a new custom field with a key of "price2" and set the value to whatever your price may be, just like setting the regular price custom field.

August 23, 2008
6:18 pm
Member
Forum Posts: 2371
Member Since:
April 24, 2008
Offline

AJ, can you let me know how I would use the same function in mk3? Laughing

Forum Timezone: UTC 0

Most Users Ever Online: 40

Currently Online:
16 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.