Jump to content

SSL Error when exceeding qty in cart


polomint

Recommended Posts

Hi guys, I know what your thinking! Its him again lolz

Anyways str8 to the point, I have Prestashop Version 1.1.0.5... I plan to upgrading to the latest version but its going to be alot of work since this version is highly customized.

The site has been working wonderfully for some time now under ssl during order processing. Now its been made aware to us that there is a problem when exceeding the QTY of product if we dont have it in stock.. IE if they click up to increase stock while in the cart say to 5, and we only have 4 in stock it redirects to an error page and in internet explorer reports this as unsecure and if you click yes to continue it gets even worse. Ive noticed that if you try to add 10 products not using the cart and the product page that it prompts you with a windows dialog error box with no ssl errors, ive also noticed if you enter a invalid voucher code it gives a valid errror message. So its something its doing when you click the up arrow on the qty it must be refering to another page outside the ssl realm. DAM THING!

Ive tried editing the cart.php but always seems to redirect.

I believe this is the code which needs changing abit..

if ($add AND $qty >= 0)
               {
                   /* Product addition to the cart */
                   if (!isset($cart->id) OR !$cart->id)
                   {
                       $cart->add();
                       if ($cart->id)
                           $cookie->id_cart = intval($cart->id);
                   }
                   if ($add AND !$cart->containsProduct(intval($idProduct), intval($idProductAttribute), $customizationId) AND !$producToAdd->hasAllRequiredCustomizableFields())
                       $errors[] = Tools::displayError('please fill all required fields');
                   if (!$cart->updateQty(intval($qty), intval($idProduct), intval($idProductAttribute), $customizationId, Tools::getValue('op', 'up')))
                       $errors[] = Tools::displayError('you already have the maximum quantity available for this product')
                           .((basename($_SERVER['HTTP_REFERER']) == 'order.php') ? ('[removed]setTimeout("history.back()",5000);[removed]
- '.
                           Tools::displayError('You will be redirected to your cart in a few seconds.')) : '');
               }
               elseif ($delete)
               {
                   if (Cart::getNbProducts($cart->id) == 1)
                   {
                       $discounts = $cart->getDiscounts();
                       foreach($discounts AS $discount)
                       {
                           $discountObj = new Discount(intval($discount['id_discount']), intval($cookie->id_lang));
                           if ($tmpError = $cart->checkDiscountValidity($discountObj, $discounts, $cart->getOrderTotal(true, 1), $cart->getProducts()))
                               $errors[] = $tmpError;
                           else
                               $cart->deleteDiscount(intval($discount['id_discount']));
                       }
                   }
                   $cart->deleteProduct(intval($idProduct), intval($idProductAttribute), $customizationId);
                   if (!Cart::getNbProducts(intval($cart->id)))
                   {
                       $cart->id_carrier = 0;
                       $cart->update();
                   }
               }
           }
           if (!sizeof($errors))
           {
                $queryString = Tools::safeOutput(Tools::getValue('query', NULL));
               if ($queryString AND !Configuration::get('PS_CART_REDIRECT'))
                   Tools::redirect('search.php?search='.$queryString);
               if (isset($_SERVER['HTTP_REFERER']))

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...