Jump to content

Číslovanie faktúr pre Prestashop 1.7.7.2


fosilia
 Share

Recommended Posts

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;
    }

Share this post


Link to post
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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More