Jump to content

Reference number on all invoices same !


webmaster.sigla

Recommended Posts

Ok, thank you.

It is best to find out the reference numbers stored in the database.

Change table prefix ps_ to your table prefix and change c.id_lang = 1 to your lang id.

SELECT a.id_product, c.name, a.reference AS product_reference, b.reference AS attribute_reference FROM ps_product a
left join ps_product_attribute b ON a.id_product = b.id_product
left join ps_product_lang c ON (a.id_product = c.id_product AND c.id_lang = 1)
group by a.id_product
order by a.reference

 

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

You mean, like, are there items with the same reference numbers in store?

All items in store are with different numbers -> 100%. ( I checked )

When customer make purchase , on invoice  always comes same number  -> all the time this -> 311020025. ( like on picture attached), but in product catalog is different - right ref. number.

Its very Strange why this is happening.

 

Link to comment
Share on other sites

Didn't you install an invoice-editing module?

If so, I will need to upload an FTP file here ./override/classes/order/OrderInvoice.php.
If not, I need the ./classes/order/OrderInvoice.php file

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

16 minutes ago, Guest said:

Didn't you install an invoice-editing module?

If so, I will need to upload an FTP file here ./override/classes/order/OrderInvoice.php.
If not, I need the ./classes/order/OrderInvoice.php file

No, i think its happen after SEO optimization module, but after this I have uninstalled this module 

Link to comment
Share on other sites

Ok.

File invoice.product-tab.tpl is good.

Check DB:

SELECT * FROM `ps_order_detail` WHERE reference = '311020025'

If it does not find more values for one order, the error will be in the wrong uninstallation of SEO module.
In this case, you will need to hire someone for repair.
This is where we will discuss the week and the repair could be done in 10-20 minutes.

Link to comment
Share on other sites

Faster will use php script.
Save it to FTP in the Prestashop root folder.
Then enter your domain and script path in the browser's address bar, eg https://mydomain.com/myscript.php

<?php
  ini_set('display_errors', 1);
  ini_set('display_startup_errors', 1);
  error_reporting(E_ALL);
  
  include('./config/config.inc.php');
  include('./config/settings.inc.php');
  include('./init.php');
  
  $order_id = Db::getInstance()->ExecuteS('select id_order, product_attribute_id, product_reference, product_id from '._DB_PREFIX_.'order_detail order by id_order');
  
  foreach ($order_id as $order)
  {
     $product_reference = '';
     
     if ($order['product_attribute_id'] == '0')
     {
       $product_reference = Db::getInstance()->getValue('select reference from '._DB_PREFIX_.'product where id_product = '.$order['product_id']);
       if ($product_reference)
       {
          Db::getInstance()->Execute('update '._DB_PREFIX_.'order_detail set product_reference = '.$product_reference);
          echo 'order id: '.$order['id_order'].' - product reference: '.$product_reference.'<br />';
       }
     } 
     else
     {
       $product_reference = Db::getInstance()->getValue('select reference from '._DB_PREFIX_.'product_attribute where id_product = '.$order['product_id'].' AND id_product_attribute = '.$order['product_attribute_id']);
       if ($product_reference)
       {
          Db::getInstance()->Execute('update '._DB_PREFIX_.'order_detail set product_reference = '.$product_reference);
          echo 'order id: '.$order['id_order'].' - product reference: '.$product_reference.'<br />';
       }
     }
  }

 

My tested result:

obrazek.png.faa4a2495f622c01ca41e6df178dde50.png

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

If I helped you and solved your problem, you can rate my posts by clicking on the gray heart. You can rate one or more posts.

I gladly helped.

Link to comment
Share on other sites

  • 4 months later...

People posting whether it worked or not AND giving kudos to the person who helped them will make this forum a better place for everyone.

Reporting that the offered solution works avoids others from trying something in vain.
And giving kudos to the person that helped them will make that person more likely to help someone else again.

It's all about paying it forward!

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...