fosilia Posted February 28, 2021 Share Posted February 28, 2021 (edited) Faktura bude mat rok, mesiac a cislo. Napr: 210200001 classes/order/order.php Vyhladat: /** * Generate a unique reference for orders generated with the same cart id * This references, is useful for check payment. * * @return string */ public static function generateReference() { return strtoupper(Tools::passwdGen(9, 'NO_NUMERIC')); } public function orderContainProduct($id_product) { $product_list = $this->getOrderDetailList(); foreach ($product_list as $product) { if ($product['product_id'] == (int) $id_product) { return true; } } return false; } Zamenit: /** * Gennerate a unique reference for orders generated with the same cart id * This references, is usefull for check payment. * * @return string */ public static function generateReference() { $query = new DbQuery(); $query->select('MAX(id_order) as max'); $query->from('orders'); $query->where('id_cart' > 0); $order = Db::getInstance()->getRow($query); $reference = $order['max'] +1 ; $date_reference = StrFTime("%y%m", Time()); return $date_reference.sprintf('%05d', $reference); } public function orderContainProduct($id_product) { $product_list = $this->getOrderDetailList(); foreach ($product_list as $product) { if ($product['product_id'] == (int) $id_product) { return true; } } return false; } Edited January 3, 2022 by fosilia (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now