Jump to content

Číslovanie faktúr pre Prestashop 1.7.8.2


fosilia

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

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

  • fosilia changed the title to Číslovanie faktúr pre Prestashop 1.7.8.2

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