Post by ronnieb » Mon Nov 19, 2012 6:49 am

Hi

Odd problem

I have just upgraded to 1.5.4 from 1.5.3.

On my website I have a page where the customer can add a item into the shopping cart, without having to go to the shop first (its just a form with options that has the correct variables eg

Code: Select all

<td nowrap="nowrap"><div align="left">Colour:
  <select name="option[77]">
        <option value="239">Blue</option>
        <option value="240">Pink</option>
      </select>


this form gets sent to

Code: Select all

<div class="content"> Qty:  <input type="text" name="quantity" size="3" value="1" />
    <input type="hidden" name="product_id" value="111" />
    <input name="submit" type="submit" value="Add to Basket" />
  </div>
</div>
</form></td>
         
<td valign="top">[b]<form action="http://www.mysite.co.uk/shop/index.php?route=checkout/cart" method="post" [/b]enctype="multipart/form-data" id="product">
this form works perfectly, as soon as the customer submits the form it immediately adds the item to their cart and shows here
http://www.mysite.co.uk/shop/index.php? ... ckout/cart


Since i have upgraded to 1.5.4

nothing goes into the cart...........

nothing has changed, the database is the same

the same name shows in the cart
http://www.mysite.co.uk/shop/index.php? ... ckout/cart, but nothing is placed in it


I can flick from 1.5.3 to 1.5.4 by renaming the shop in ftp so I dont understand why one works and the other doesnt.

somewhere a variable is being added in 1.5.4 but I dont know where

Can anyone help solve this frustrating problem !!


EDIT

as a shot in the dark

1.5.4 controller/checkout/cart.php

looks like this

Code: Select all

<?php 
class ControllerCheckoutCart extends Controller {
	private $error = array();
	
	public function index() {
		$this->language->load('checkout/cart');

		if (!isset($this->session->data['vouchers'])) {
			$this->session->data['vouchers'] = array();
		}
		
		// Update
		if (!empty($this->request->post['quantity'])) {
			foreach ($this->request->post['quantity'] as $key => $value) {
				$this->cart->update($key, $value);
			}
			
       	
		
		

whereas 1.5.3 same file looks like this

Code: Select all

<?php 
class ControllerCheckoutCart extends Controller {
	public function index() {
		$this->language->load('checkout/cart');
		
		if ($this->request->server['REQUEST_METHOD'] == 'POST') {
      		if (isset($this->request->post['quantity'])) {
				if (!is_array($this->request->post['quantity'])) {
					if (isset($this->request->post['option'])) {
						$option = $this->request->post['option'];
					} else {
						$option = array();	
					}
			
      				$this->cart->add($this->request->post['product_id'], $this->request->post['quantity'], $option);
				} else {
					foreach ($this->request->post['quantity'] as $key => $value) {
	      				$this->cart->update($key, $value);
					}
				}
      		}


so Im presumming that this is the reason .........

can anyone help ????

New member

Posts

Joined
Tue May 24, 2011 3:44 pm
Who is online

Users browsing this forum: No registered users and 2 guests