A A A
Avatar

Please consider registering
guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





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

sp_Feed Topic RSS sp_TopicIcon
Transform E-Junkie Cart to Our Ajax Cart
June 15, 2008
7:19 am
Avatar
Admin
Forum Posts: 5862
Member Since:
March 16, 2008
sp_UserOfflineSmall Offline

Rather than download Market 3 all over again if you have already made changes, the following post will outline how to change the e-junkie cart to the new self-hosted ajax cart.

First things first: Head to the Download Center and download the Ajax Cart Module, which includes just the ajax cart folder and a readme containing an exact copy of this post. Before you upload, open up the config.php file found inside the ajCart folder. There are three lines that require your editing - the url to the cart folder, cart.php file, and your paypal email. Edit these three values, save, and upload.The ajCart folder must be place inside the mk3 theme folder (ex: …/wp-content/themes/mk3/ajCart/).

Now for the edits. Start by opening Market 3's single.php. You'll see comments for “Start VCart Code” and “End Vcart Code“. Replace the entire chunk of code between that with the following:

<form class=”crtAdd rsf” method=”post” action=”<?php bloginfo('template_directory'); ?>/ajCart/cart.php” >

<input type=”hidden” name=”cmd” value=”_cart”>

<input type=”hidden” name=”add” value=”1″>

<input type=”hidden” name=”quantity” value=”1″>

<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_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=”lc” value=”US”>

<input type=”hidden” name=”currency_code” value=”USD”>

<input type=”hidden” name=”return” value=”<?php bloginfo('url'); ?>”>

<input type=”hidden” name=”cancel_return” value=”<?php bloginfo('url'); ?>”>

<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>

</table>

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

</form>

If you wish to use the Multiple Shipping option / pricing hack, use the following code chunk instead:

<form class=”crtAdd rsf” method=”post” action=”<?php bloginfo('template_directory'); ?>/ajCart/cart.php” >

<input type=”hidden” name=”cmd” value=”_cart”>

<input type=”hidden” name=”add” value=”1″>

<input type=”hidden” name=”quantity” value=”1″>

<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_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=”lc” value=”US”>

<input type=”hidden” name=”currency_code” value=”USD”>

<input type=”hidden” name=”return” value=”<?php bloginfo('url'); ?>”>

<input type=”hidden” name=”cancel_return” value=”<?php bloginfo('url'); ?>”>

<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 s2=0.50″>Normal $1.00</option>

<option value=”s1=2.00 s2=0.60″>Two days $2.00</option>

<option value=”s1=3.00 s2=0.70″>Overnight $3.00</option>

</select>

</td>

</tr>

</table>

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

</form>

Next, open up the header.php file. Most of what changes here is inside the actual head tags (calls for new scripts, etc). So if you made any template edits, just focus on the new items inside the head tags. You'll also notice that the “View Cart” link in the navigation is replaced and no longer points to E-Junkie. Anyways if you are doing a straight replace of the entire header.php file, you'll need to replace it with the following:

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”

http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-transitional.dtd”&gt;

<html xmlns=”http://www.w3.org/1999/xhtml&rdquo; xml:lang=”en” lang=”en”>

<head>

<title>

<?php bloginfo('name'); ?>

<?php if (is_home()) { ?>

:

<?php bloginfo('description'); ?>

<?php } ?>

<?php if (is_category()) { ?>

| Categories

<?php } ?>

<?php wp_title('|'); ?>

<?php if (is_author()) { ?>

|

<?php _e('About Author') ?>

<?php } ?>

<?php if (is_search()) { ?>

|

<?php _e('Search Results for: '); echo $s; ?>

<?php } ?>

</title>

<link rel=”stylesheet” href=”<?php bloginfo('stylesheet_url'); ?>” type=”text/css” media=”screen” title=”default” />

<link rel=”alternate” type=”application/rss+xml” title=”<?php bloginfo('name'); ?> RSS Feed” href=”<?php bloginfo('rss2_url'); ?>” />

<link rel=”pingback” href=”<?php bloginfo('pingback_url'); ?>” />

<script src=”<?php bloginfo('template_directory'); ?>/ajCart/jquery.js” type=”text/javascript”></script>

<script src=”<?php bloginfo('template_directory'); ?>/ajCart/jquery.form.js” type=”text/javascript”></script>

<script src=”<?php bloginfo('template_directory'); ?>/ajCart/thickbox.js” type=”text/javascript”></script>

<script type="text/javascript">
$(document).ready(function() {
var CARTDIR="<?php bloginfo('template_directory'); ?>/ajCart/";
var PPEmail="<?php bloginfo('admin_email'); ?>";
imgLoader.src = CARTDIR + "loadingAnimation.gif";

$('.crtAdd').ajaxForm({
//intercept the submit event with a callback
beforeSubmit: function(formData, jqForm, options) {
//serialize form data; append to the form action; tack on ThickBox params
var URL = jqForm[0].action + "?" + $.param(formData);
URL += "&height=220&width=600"+"&PPEmail="+PPEmail+"&CARTDIR="+CARTDIR;

var form = jqForm[0];
if (form.shp){
var shipping = form.shp.value;
if (form.shp.selectedIndex==0) { // force a selection
alert ("Make a shipping selection!");
return false;
}

var ary = shipping.split (" "); // break apart
for (j=0; j<ary.length; j++) {
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
URL += "&" + "handling=" + val;
if (tok == "hc=") // value for handling cart
URL += "&" + "handling_cart=" + val;
if (tok == "s1=") // value for shipping
URL += "&" + "shipping=" + val;
if (tok == "s2=") // value for shipping2
URL += "&" + "shipping2=" + val;
}
}
//call ThickBox directly
var caption = "My Shopping Cart";
var imageGroup = false;
tb_show(caption,URL,imageGroup);
//cancel the form submission by returning false
return false;
}
});

});
</script>

<link rel=”stylesheet” href=”<?php bloginfo('stylesheet_directory'); ?>/ajCart/thickbox.css” type=”text/css” media=”screen” title=”default” />

<script src=”<?php bloginfo('template_directory'); ?>/js/FancyZoom.js” type=”text/javascript”></script>

<script src=”<?php bloginfo('template_directory'); ?>/js/FancyZoomHTML.js” type=”text/javascript”></script>

<?php wp_head(); ?>

</head>

<body onload=”setupZoom()”>

<div id=”bar”>

<div class=”sdl”><p>Search for a item:</p>

<form style=”margin-bottom:0;margin:0;” method=”get” action=”<?php echo $_SERVER['PHP_SELF']; ?>”>

<input class=”postform” type=”text” name=”s” value=”Search for something” onfocus=”this.value='',this.style.backgroundColor='#fff'” onblur=”this.style.backgroundColor='#EEEEEE'” size=”42″ id=”search_input” /> <input type=”image” src=”<?php bloginfo('template_directory'); ?>/imgs/search.gif” value=”Search” alt=”Search” title=”Search” />

</form></div>

<div style=”clear:both;”></div>

</div>

<div id=”nav”>

<div class=”navbar”>

<ul>

<li<?php if ( is_home() ) { echo ' class=”current_page_item”'; } ?>><a href=”<?php bloginfo('url'); ?>”>Home</a></li>

<?php

wp_list_pages('title_li=&depth=1'); ?>

<li><a href=”<?php bloginfo('template_directory'); ?>/ajCart/cart.php?cart=true&height=220&width=600&CARTDIR=<?php bloginfo('template_directory'); ?>/ajCart/&PPEmail=<?php bloginfo('admin_email'); ?>” class=”thickbox” title=”My Shopping Cart” >View Cart</a></li>

</ul>

<div style=”clear:both;”></div>

</div>

</div>

<div style=”clear:both;”></div>

<div id=”wrap”>

<div id=”header”><a href=”<?php bloginfo('url'); ?>” alt=”<?php bloginfo('name'); ?> - Home”><img src=”<?php bloginfo('template_directory'); ?>/imgs/logo.gif” alt=”<?php bloginfo('name'); ?>” /></a></div>

<div id=”content”>

Finally we need to edit the footer.php. All we are doing in the footer is removing the call to E-junkie (wrapped around a script tag) and changing the “View Cart” link to match the new view cart link as seen in the header. If you are doing a full replace of the footer.php file, it should now look like this:

<div style=”clear: both”></div>
</div>
<div id=”footer”>
<div class=”col1″><p>Search for a item:</p>
<form style=”margin-bottom:0;margin:0;” method=”get” action=”<?php echo $_SERVER['PHP_SELF']; ?>”>
<input class=”postform” type=”text” name=”s” value=”Search for something” onfocus=”this.value='',this.style.backgroundColor='#fff'” onblur=”this.style.backgroundColor='#fff'” size=”42″ id=”search_input” /> <input type=”image” src=”<?php bloginfo('template_directory'); ?>/imgs/sf.png” value=”Search” alt=”Search” title=”Search” />
</form></div>
<div class=”col2″><p>Have items in your cart?<br /><img src=”<?php bloginfo('template_directory'); ?>/imgs/calc.png”> <a href=”<?php bloginfo('template_directory'); ?>/ajCart/cart.php?cart=true&height=220&width=600&CARTDIR=<?php bloginfo('template_directory'); ?>/ajCart/&PPEmail=<?php bloginfo('admin_email'); ?>” class=”thickbox” title=”My Shopping Cart”>View it now to checkout.</a></p>
</div>
<div style=”clear: both”></div>
</div>

<div id=”copyright”><p><?php bloginfo('name'); ?> is powered by <a href=”http://www.wordpress.org”>Wordpress</a&gt; and the <a href=”http://www.markettheme.com”>Market Theme</a></div>

<div style=”clear: both”></div>
</div>
<?php wp_footer(); ?>
</body>
</html>

Once this is done, your cart should now be ajaxified and using its own, self hosted version of the ajax cart!

Forum Timezone: UTC 0

Most Users Ever Online: 213

Currently Online:
4 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

icy1: 2636

wreed06: 175

laurie390: 169

boutiqueelliette: 156

StitchTek Services, LLC: 144

yiorgos: 127

Member Stats:

Guest Posters: 457

Members: 2471

Moderators: 1

Admins: 1

Forum Stats:

Groups: 1

Forums: 4

Topics: 4078

Posts: 18978

Newest Members: teddy1, raycrean, tseibt55, aceman, peteryoung320@gmail.com, JdsCentral

Moderators: Market Admin: 5862

Administrators: Market Admin: 5862

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