We're doing some heavy development for a client and thanks to the forums we have been able to find answers to everything (almost) with ease! Great development community here. Anyways the one I can't find a solid/working answer to is this:
We have an object that adds products to the cart, well we're facing issues. Firstly the best and easiest way to do this would be to add items to the cart via GET which for WHATEVER reason it was removed in 1.5, I've been trying all the different mods and solutions here on the forums but haven't had success.
I tried to bridge the gap by using the method found in this post: http://forum.opencart.com/viewtopic.php?f=20&t=49872 in which I did the following:
Code: Select all
if ( ($_GET['route'] == "checkout/cart") && isset($_GET['product_id']) ) {
$addtocart = true;
$pids = array();
$pids = $_GET['product_id'];
}
if ( $addtocart == true ) {
echo '<form action="index.php?route=checkout/cart" id="frm" method="post">';
for ($i=0; $i < count($pids); $i++) {
echo '<input type="hidden" name="product_id" value="'.$pids[$i].'">';
echo '<input type="hidden" name="quantity" value="1">';
}
echo '</form>';
}
?>
<body<?
if ( $addtocart == true) {
echo ' onLoad="document.getElementById("frm").submit()"';
}
?>>
I also tried using the cart.php from here: http://forum.opencart.com/viewtopic.php?f=20&t=54138 but that just broke the add to cart buttons. This may be the solution but I can't figure out how to keep the add to cart buttons working.
I have about 20 threads open for various discussions on it but none seem to be working. ANY help would be appreciated big time, we're tyring to get this done ASAP. Thanks guys!
PS latest version of opencart.