SimpleCart

9 posts by 3 authors in: Forums > CMS Builder: Plugins & Add-ons
Last Post: July 2, 2012   (RSS)

By kdub718 - June 13, 2012 - edited: June 13, 2012

So I have the SimpleCart setup but when I add a product to the cart it takes me to the cart page. Is there a way I can add to cart without it taking me to that page? It will stay on the current page so I can add more products?

I think this is the code for it... or am I missing it and its in the schema somewhere?

<!-- add to cart -->
<?php
$formName = "addform" . $record['num'];
$cartItems = array(
array(
'name' => $record['name'],
'unitPrice' => $record['price'],
'recordNum' => $record['num'],
'tableOrTag' => '_sc_example_products',
'quantity=' => '_sc_quantity',
),
//array('name' => 'Color: Blue', 'OPTION' => TRUE),
//array('name' => 'Region: North', 'OPTION' => TRUE),
//array('name' => 'Size: Xl', 'OPTION' => TRUE),
);
?>
<form method="post" name="<?php echo $formName ?>" action="?">
<input type="hidden" name="_sc_action" value="add">
<?php sc_createAddFormData($cartItems); ?>

<input type="text2" name="_sc_quantity" size="5" maxlength="5" value="0" /><br/>
<a href="#" title="Add to Cart" class="addToCart" onclick="document.forms.<?php echo $formName ?>.submit(); return false;">Add to Cart</a><br />
</form>
<!-- /add to cart -->

Re: [kdub718] SimpleCart

By robin - June 14, 2012

Hey,

You can tell simple cart where to send the user by using "_sc_nextUrl". If you add something this to your form it should return to the current page.

<input type="hidden" name="_sc_nextUrl" value="?">

Hope that helps,
Robin
Robin
Programmer
interactivetools.com

Re: [robin] SimpleCart

By kdub718 - June 14, 2012

Perfecto..! Thank you so much... I'm sure I'll have a few more questions with this before I'm done with it... These forums are very helpful... Thanks again!

Re: [kdub718] SimpleCart

By kdub718 - June 26, 2012 - edited: June 26, 2012

So I just found a problem. It works where it returns me to domain.com/mainlink.php?

But if I'm in a section like domain.com/mainlink.php?categoryname# and click it, it returns me to domain.com/mainlink.php? doesn't leave me in the category.

Any ideas for returning me back to the category I was in?

I'm guessing because the value is "?"

Re: [kdub718] SimpleCart

By robin - June 27, 2012

Hey kdub,

You could add the category to the next_url. Like:

<input type="hidden" name="_sc_nextUrl" value="?<?php echo $category; ?>">


Or use the "REQUEST_URI" server variable

<input type="hidden" name="_sc_nextUrl" value="<?php echo $_SERVER['REQUEST_URI']; ?>">

Hope that helps,
Robin
Robin
Programmer
interactivetools.com

Re: [robin] SimpleCart

By kdub718 - June 27, 2012

yah I didn't wanna do the value of category cause when the category changes it wouldn't work.

So the 2nd option work perfectly thanks.

I was chatting with dave and he said your the programmer that programmed the cart. So he said I should talk to you. I wanna remove the payment/paypal option. Basically just want the orders to be emailed.

Re: [kdub718] SimpleCart

By robin - June 27, 2012

Hi,

What is your setup right now? Is the user re-directed to Paypal on submit?

Thanks
Robin
Programmer
interactivetools.com

Re: [robin] SimpleCart

By kdub718 - June 27, 2012

yah... All I want it to do is just email the order... no payment or anything