Jump to content

Error when attempting to put item in Cart


Recommended Posts

In PS 1.5.6.2 I'm trying to put an item in the Cart.

 

I've turned error checking to on in the defines.inc.php file.

 

The following error appears when I try to put an item in the Cart.

 

Any idea why this is happening?

 

_________________________________________________________________________

 

Impossible to add the product to the cart.

textStatus: 'error'
errorThrown: 'Internal Server Error'
responseText:
<style>

                #psException{font-family: Verdana; font-size: 14px}

                #psException h2{color: #F20000}

                #psException p{padding-left: 20px}

                #psException ul li{margin-bottom: 10px}

                #psException a{font-size: 12px; color: #000000}

                #psException .psTrace, #psException .psArgs{display: none}

                #psException pre{border: 1px solid #236B04; background-color: #EAFEE1; padding: 5px; font-family: Courier; width: 99%; overflow-x: auto; margin-bottom: 30px;}

                #psException .psArgs pre{background-color: #F1FDFE;}

                #psException pre .selected{color: #F20000; font-weight: bold;}

            </style><div id="psException"><h2>[PrestaShopDatabaseException]</h2><p><b>You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '> 0 and

            (

                select cost from eds_geo_cost g where g.id_supplier = d.id_s' at line 36<br /><br /><pre>

SELECT id_supplier,id_product,shipmethod, (linkcost + qwacost + IFNULL(add_cost,0)) AS cost,

        address1,address2,city,state,country,pincode,email,phone,avl,delivery_service,width,height,depth,weight

from

(

    select id_supplier,id_product,

        qwa,zipgeo,shipmethod,linkcost,

        case when shipmethod = 0 then 0 else 1 end as avl,

        case

            when shipmethod = 1

            then

            (

                select c.cost

                from eds_cost_setting c

                where c.id_supplier=d.id_supplier and

                (

                    (qwa=1 and cfrom<=wt and cto>=wt) or

                    (qwa=2 and cfrom<=amt and cto>=amt) or

                    (qwa=3 and cfrom<=qty and cto>=qty)

                )

            )

            else 0

        end as qwacost,

        case

            when shipmethod = 1 and zipgeo = 1 then

            (

                select cost from eds_cost_pincode z where z.id_supplier=d.id_supplier and z.pincode like '%%' limit 0,1

            )

            when shipmethod = 1 and zipgeo = 2 and 0>0 and

            (

                select cost from eds_geo_cost g where g.id_supplier = d.id_supplier and id_county = 0

            ) > 0

            then

            (

                select cost from eds_geo_cost g where g.id_supplier = d.id_supplier and id_county  = 0

            )

            when shipmethod = 1 and zipgeo = 2 and  > 0 and

            (

                select cost from eds_geo_cost g where g.id_supplier = d.id_supplier and id_state  =

            ) > 0

            then

            (

                select cost from eds_geo_cost g where g.id_supplier = d.id_supplier and id_state  =

            )

            when shipmethod = 1 and zipgeo = 2 and  > 0 and

            (

                select cost from eds_geo_cost g where g.id_supplier = d.id_supplier and id_country  =

            ) > 0

            then

            (

                select cost from eds_geo_cost g where g.id_supplier = d.id_supplier and id_country  =

            )

        else 0 end as add_cost,

        qty,wt as weight,amt,address1,address2,city,state,country,pincode,email,phone,delivery_service,width,height,depth

    from

    (

        select     p.id_supplier,p.id_product,

                sum(cp.quantity) as qty, sum((p.weight+IFNULL(a.weight,0))*cp.quantity) as wt,

                sum((p.price +IFNULL(a.price,0))*cp.quantity) as amt,

                address1,address2,city,state,country,sp.pincode,email,phone,

                method as qwa,add_type as zipgeo,ifnull(id_method,0) as shipmethod,l.cost as linkcost,delivery_service,

                IFNULL(sum(width),0) as width,

                                IFNULL(max(height),0) as height,

                                IFNULL(max(depth),0) as depth

                                

        from ps_cart c

        inner join ps_cart_product cp on c.id_cart = cp.id_cart

        inner join ps_product p on cp.id_product=p.id_product

        left join eds_supplier_profile sp on p.id_supplier = sp.id_supplier

        left join ps_product_attribute a on a.id_product_attribute = cp.id_product_attribute

        left join eds_carrier_link l on l.id_supplier = p.id_supplier and l.id_carrier = 139

        where c.id_cart = 148 and p.id_supplier>0

        group by p.id_supplier

    ) as d

) as s</pre></b><br /><i>at line </i><b>613</b><i> in file </i><b>classes/db/Db.php</b></p><div class="psTrace" id="psTrace_" style="display: block"><pre>607.             WebserviceRequest::getInstance()->setError(500, '

 '.$this->getMsgError().'. From '.(isset($dbg[3]['class']) ? $dbg[3]['class'] : '').'->'.$dbg[3]['function'].'() Query was : '.$sql, 97);
608.         }
609.         else if (_PS_DEBUG_SQL_ && $errno && !defined('PS_INSTALLATION_IN_PROGRESS'))
610.         {
611.             if ($sql)
<span class="selected">612.                 throw new PrestaShopDatabaseException($this->getMsgError().'<br /><br /><pre>'.$sql.'</pre>');
</span>613.             throw new PrestaShopDatabaseException($this->getMsgError());
614.         }
615.     }
616.
617.     /**
</pre></div><ul><li><b>DbCore->displayError</b> - <a href="#" style="font-size: 12px; color: #000000" onclick="document.getElementById('psTrace_0').style.display = (document.getElementById('psTrace_0').style.display != 'block') ? 'block' : 'none'; return false">[line 313 - classes/db/Db.php]</a> - <a href="#" onclick="document.getElementById('psArgs_0').style.display = (document.getElementById('psArgs_0').style.display != 'block') ? 'block' : 'none'; return false">[1 Arguments]</a><div class="psTrace" id="psTrace_0" ><pre>307.         if ($sql instanceof DbQuery)
308.             $sql = $sql->build();
309.
310.         $this->result = $this->_query($sql);
311.         if (_PS_DEBUG_SQL_)
<span class="selected">312.             $this->displayError($sql);
</span>313.         return $this->result;
314.     }
315.
316.     /**
317.      * Execute an INSERT query
</pre></div><div class="psArgs" id="psArgs_0"><pre><b>Argument [0]</b>


SELECT id_supplier,id_product,shipmethod, (linkcost + qwacost + IFNULL(add_cost,0)) AS cost,

        address1,address2,city,state,country,pincode,email,phone,avl,delivery_service,width,height,depth,weight

from

(

    select id_supplier,id_product,

        qwa,zipgeo,shipmethod,linkcost,

        case when shipmethod = 0 then 0 else 1 end as avl,

        case

            when shipmethod = 1

            then

            (

                select c.cost

                from eds_cost_setting c

                where c.id_supplier=d.id_supplier and

                (

                    (qwa=1 and cfrom<=wt and cto>=wt) or

                    (qwa=2 and cfrom<=amt and cto>=amt) or

                    (qwa=3 and cfrom<=qty and cto>=qty)

                )

            )

            else 0

        end as qwacost,

        case

            when shipmethod = 1 and zipgeo = 1 then

            (

                select cost from eds_cost_pincode z where z.id_supplier=d.id_supplier and z.pincode like '%%' limit 0,1

            )

            when shipmethod = 1 and zipgeo = 2 and 0>0 and

            (

                select cost from eds_geo_cost g where g.id_supplier = d.id_supplier and id_county = 0

            ) > 0

            then

            (

                select cost from eds_geo_cost g where g.id_supplier = d.id_supplier and id_county  = 0

            )

            when shipmethod = 1 and zipgeo = 2 and  > 0 and

            (

                select cost from eds_geo_cost g where g.id_supplier = d.id_supplier and id_state  =

            ) > 0

            then

            (

                select cost from eds_geo_cost g where g.id_supplier = d.id_supplier and id_state  =

            )

            when shipmethod = 1 and zipgeo = 2 and  > 0 and

            (

                select cost from eds_geo_cost g where g.id_supplier = d.id_supplier and id_country  =

            ) > 0

            then

            (

                select cost from eds_geo_cost g where g.id_supplier = d.id_supplier and id_country  =

            )

        else 0 end as add_cost,

        qty,wt as weight,amt,address1,address2,city,state,country,pincode,email,phone,delivery_service,width,height,depth

    from

    (

        select     p.id_supplier,p.id_product,

                sum(cp.quantity) as qty, sum((p.weight+IFNULL(a.weight,0))*cp.quantity) as wt,

                sum((p.price +IFNULL(a.price,0))*cp.quantity) as amt,

                address1,address2,city,state,country,sp.pincode,email,phone,

                method as qwa,add_type as zipgeo,ifnull(id_method,0) as shipmethod,l.cost as linkcost,delivery_service,

                IFNULL(sum(width),0) as width,

                                IFNULL(max(height),0) as height,

                                IFNULL(max(depth),0) as depth

                                

        from ps_cart c

        inner join ps_cart_product cp on c.id_cart = cp.id_cart

        inner join ps_product p on cp.id_product=p.id_product

        left join eds_supplier_profile sp on p.id_supplier = sp.id_supplier

        left join ps_product_attribute a on a.id_product_attribute = cp.id_product_attribute

        left join eds_carrier_link l on l.id_supplier = p.id_supplier and l.id_carrier = 139

        where c.id_cart = 148 and p.id_supplier>0

        group by p.id_supplier

    ) as d

) as s
</pre></li><li><b>DbCore->query</b> - <a href="#" style="font-size: 12px; color: #000000" onclick="document.getElementById('psTrace_1').style.display = (document.getElementById('psTrace_1').style.display != 'block') ? 'block' : 'none'; return false">[line 488 - classes/db/Db.php]</a> - <a href="#" onclick="document.getElementById('psArgs_1').style.display = (document.getElementById('psArgs_1').style.display != 'block') ? 'block' : 'none'; return false">[1 Arguments]</a><div class="psTrace" id="psTrace_1" ><pre>482.         {
483.             $this->last_cached = true;
484.             return $result;
485.         }
486.
<span class="selected">487.         $this->result = $this->query($sql);
</span>488.         if (!$this->result)
489.             return false;
490.
491.         $this->last_cached = false;
492.         if (!$array)
</pre></div><div class="psArgs" id="psArgs_1"><pre><b>Argument [0]</b>


SELECT id_supplier,id_product,shipmethod, (linkcost + qwacost + IFNULL(add_cost,0)) AS cost,

        address1,address2,city,state,country,pincode,email,phone,avl,delivery_service,width,height,depth,weight

from

(

    select id_supplier,id_product,

        qwa,zipgeo,shipmethod,linkcost,

        case when shipmethod = 0 then 0 else 1 end as avl,

        case

            when shipmethod = 1

            then

            (

                select c.cost

                from eds_cost_setting c

                where c.id_supplier=d.id_supplier and

                (

                    (qwa=1 and cfrom<=wt and cto>=wt) or

                    (qwa=2 and cfrom<=amt and cto>=amt) or

                    (qwa=3 and cfrom<=qty and cto>=qty)

                )

            )

            else 0

        end as qwacost,

        case

            when shipmethod = 1 and zipgeo = 1 then

            (

                select cost from eds_cost_pincode z where z.id_supplier=
Link to comment
Share on other sites

×
×
  • Create New...