Jump to content

Unwanted items in invoice & shopping cart?


Recommended Posts

Hi all,

 

I have a serious problem with my store's shopping cart. It's gone online and our first customer's order contains items in his invoice that he didn't order! I had that a couple of times when still testing, BUT not after I placed the order. I removed all the items that appeared suddenly in my cart before I placed order and they didn't appear in my invoice. Some items just stay in my shopping cart. I deleted my cookies, cache and restart browser. After that I check back and at first my shopping cart is empty, then I tried to add an item into cart, miraculously another item(s) were also added! I don't know what's wrong. I searched and searched but couldn't find anything. So it seems this is not a common problem?

 

I have a custom script in index.php to create cookie for postcode check purpose:

<?php
if(!isset($_COOKIE['been_here']))
{
echo '<meta  http-equiv="refresh"content="0;URL=index2.php">'; // postcodecheck if client has never been here
}
if(isset($_COOKIE['been_here']))
{
/* notice of license of prestashop*/

require(dirname(__FILE__).'/config/config.inc.php');

Dispatcher::getInstance()->dispatch();

}
/*--- end of code---*/

And I created an extra page called index2.php where the postcode check script is stored:

<?php
if($_SERVER['REQUEST_METHOD'] == 'POST') 
   {
    if(isset($_POST['postcodecheck']))
{   
$code_lang =$_POST['postcodecheck'];
$code = substr($code_lang, 0, 4 );
  }     
   $postcode_array = array("1011", "1018");
   if (in_array($code, $postcode_array))
    {
/* ------cookie is made starting here---*/
$two_months = 60 * 60 * 24 * 60 + time();
setcookie('been_here', true, $two_months);
/* --end of cookie ---*/
echo'<p class="alert good">We deliver to your postcode. We're redirecting you to our online store.</p>
<meta  http-equiv="refresh"content="3;URL=index.php"> 
'; 
} 
else
{ 
echo' <p class="alert error">We don't deliver to your postcode.</p> ';

}
} // end of request
?>

Is it maybe a cookie clash? I tried to delete these two files and put the original index.php back without the custom cookie sc, but the problem is still there. I also tried to disable ajax in cart, deleted cache/smarty/compile and cache/smarty/cache files... Nothing helped...

 

My Prestashop version: 1.5.017

 

Please help! Any help will be greatly appreciated. I have left many topics on different problems but nobody replied. I'm having serious thought of whether to choose Prestashop again for my next project...

Edited by ziye (see edit history)
Link to comment
Share on other sites

Hi El Patron, thank you for your reply.

 

I deleted the products in the back office. I don't remember using 3rd party module to delete products. And I deleted records of cart, customer and address manually via phpmyadmin using truncate table command.

 

One more thing, I also see old payment records of 5 months ago (when I was still testing!) and invoice with date that is 5 months old under "Orders" of the client!

Link to comment
Share on other sites

Hi El Patron, thank you for your reply.

 

I deleted the products in the back office. I don't remember using 3rd party module to delete products. And I deleted records of cart, customer and address manually via phpmyadmin using truncate table command.

 

One more thing, I also see old payment records of 5 months ago (when I was still testing!) and invoice with date that is 5 months old under "Orders" of the client!

you misunderstood, not delete 'products', but delete 'orders'

 

see if this post helps

http://www.prestashop.com/forums/topic/220197-adding-product-to-cart-ps-adds-also-some-other-products/?do=findComment&comment=1149116

Link to comment
Share on other sites

you misunderstood, not delete 'products', but delete 'orders'

 

see if this post helps

http://www.prestashop.com/forums/topic/220197-adding-product-to-cart-ps-adds-also-some-other-products/?do=findComment&comment=1149116

Sorry that I misunderstood you. Please bear with me. I didn't delete orders from back office but I manually deleted orders in phpmyadmin using truncate table ps_orders command.

 

So basically I should delete manually via phpmyadmin ps_cart_product & ps_cart? With which command? Truncate?

Edited by ziye (see edit history)
Link to comment
Share on other sites

Sorry that I misunderstood you. Please bear with me.

 

So basically I should delete manually via phpmyadmin ps_cart_product & ps_cart? With which command? Truncate?

 

NO

"deleting all rows on ps_cart_products that has no corresponding ps_cart row"

 

1. you should 1) be comfortable with using phpmyamdin and mysql db

2. you should first export your db for back up

 

first just look  at the yourprefix_cart_products and see if there is no corresponding yourprefiix_cart_row

 

and  report back what you found, without deleting anything

 

you need to

Link to comment
Share on other sites

NO

"deleting all rows on ps_cart_products that has no corresponding ps_cart row"

 

1. you should 1) be comfortable with using phpmyamdin and mysql db

2. you should first export your db for back up

 

first just look  at the yourprefix_cart_products and see if there is no corresponding yourprefiix_cart_row

 

and  report back what you found, without deleting anything

 

you need to

 

I checked and found that ps_cart has 35 rows and ps_cart_product is missing several id's: 5,17,20,22,32,33. How can I fix this?

Link to comment
Share on other sites

You didn't have to tell me step by step. I was actually doing what you asked me to do, to report it back to you about what I found. As this is a forum, I assume it's a place where people seek help. As I'm using Prestashop for the first time (and also the last time) this is the only place where I thought I could ask for help. Not everyone who has e-commerce site has basic knowledge of database. Some has little knowledge and messed it up UNintentionally and is finding ways to fix it and listening to advices given.

 

Thanks for your help till here.

Edited by ziye (see edit history)
Link to comment
Share on other sites

×
×
  • Create New...