2017-03-16 31 views
1

我們希望修改prestashop中的訂單參考邏輯,爲此我們實現了邏輯。邏輯很好。偉大的工作,但我們得到了一個錯誤如何在prestashop中增加訂單參考長度

[PrestaShopException] 

Property OrderPayment->order_reference length (14) must be between 0 and 9 at line 909 in file classes/ObjectModel.php 

904.    } 
905. 
906.    $message = $this->validateField($field, $this->$field); 
907.    if ($message !== true) { 
908.     if ($die) { 
909.      throw new PrestaShopException($message); 
910.     } 
911.     return $error_return ? $message : false; 
912.    } 
913.   } 
914. 

我們的長度爲30,我們怎樣才能提高9到30的長度?

回答

1

你需要重寫OrderPayment類文件/override/classes/order/OrderPayment.php

<?php 
class OrderPayment extends OrderPaymentCore 
{ 
    public function __construct($id = null, $id_lang = null, $id_shop = null) 
    { 
     self::$definition['fields']['order_reference']['size'] = 30; 
     parent::__construct($id, $id_lang, $id_shop); 
    } 
} 

另外,您必須更新phpMyAdmin的SQL選項卡中的數據庫order_reference字段大小:

ALTER TABLE `ps_order_payment` 
CHANGE `order_reference` 
`order_reference` VARCHAR(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL; 
+0

感謝名單...它工作.... –

+0

如果這個答案解決了你的問題,你能否接受它來標記此線程已解決? [如何接受答案的工作?](https://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work) –

+0

如何做到這一點? –