Jump to content
  • 0

Błąd 500 podczas dodawania towaru do koszyka


smiglon

Question

Witam'Jak w temacie, podczas dodawania do koszyka produktu, serwer wywala błąd 500...

Komunikat z log:

[16-Sep-2015 21:21:01 Europe/Warsaw] PHP Fatal error:  Undefined class constant 'ROUND_TOTAL' in /sklep/classes/Cart.php on line 702
[16-Sep-2015 21:26:54 Europe/Warsaw] PHP Fatal error:  Undefined class constant 'ROUND_TOTAL' in /sklep/classes/Cart.php on line 702
[16-Sep-2015 22:53:56 Europe/Warsaw] PHP Fatal error:  Undefined class constant 'ROUND_ITEM' in /sklep/controllers/admin/AdminPreferencesController.php on line 161
[16-Sep-2015 22:54:02 Europe/Warsaw] PHP Fatal error:  Undefined class constant 'ROUND_ITEM' in /sklep/controllers/admin/AdminPreferencesController.php on line 161
[17-Sep-2015 09:58:20 Europe/Warsaw] PHP Fatal error:  Undefined class constant 'ROUND_TOTAL' in /sklep/classes/Cart.php on line 702
[18-Sep-2015 00:06:30 Europe/Warsaw] PHP Fatal error:  Undefined class constant 'ROUND_TOTAL' in /sklep/classes/Cart.php on line 702
[18-Sep-2015 00:06:37 Europe/Warsaw] PHP Fatal error:  Undefined class constant 'ROUND_TOTAL' in /sklep/classes/Cart.php on line 702
[18-Sep-2015 00:07:01 Europe/Warsaw] PHP Fatal error:  Undefined class constant 'ROUND_TOTAL' in /sklep/classes/Cart.php on line 702

Wiersz 702 w cart.php:

                switch (Configuration::get('PS_ROUND_TYPE')) {
                    case Order::ROUND_TOTAL:
                        $row['total'] = $row['price_with_reduction_without_tax'] * (int)$row['cart_quantity'];
                        $row['total_wt'] = $row['price_with_reduction'] * (int)$row['cart_quantity'];
                        break;
                    case Order::ROUND_LINE:
                        $row['total'] = Tools::ps_round($row['price_with_reduction_without_tax'] * (int)$row['cart_quantity'], _PS_PRICE_COMPUTE_PRECISION_);
                        $row['total_wt'] = Tools::ps_round($row['price_with_reduction'] * (int)$row['cart_quantity'], _PS_PRICE_COMPUTE_PRECISION_);
                        break;
     
                    case Order::ROUND_ITEM:
                    default:
                        $row['total'] = Tools::ps_round($row['price_with_reduction_without_tax'], _PS_PRICE_COMPUTE_PRECISION_) * (int)$row['cart_quantity'];
                        $row['total_wt'] = Tools::ps_round($row['price_with_reduction'], _PS_PRICE_COMPUTE_PRECISION_) * (int)$row['cart_quantity'];
                        break;
                }

AdminPreferencesController.php wiersz 161:

                    'PS_ROUND_TYPE' => array(
                        'title' => $this->l('Round type'),
                        'desc' => $this->l('You can choose when to round prices: either on each item, each line or the total (of an invoice, for example).'),
                        'cast' => 'intval',
                        'type' => 'select',
                        'list' => array(
                            array(
                                'name' => $this->l('Round on each item'),
                                'id' => Order::ROUND_ITEM
                                ),
                            array(
                                'name' => $this->l('Round on each line'),
                                'id' => Order::ROUND_LINE
                                ),
                            array(
                                'name' => $this->l('Round on the total'),
                                'id' => Order::ROUND_TOTAL
                                ),
                            ),
                        'identifier' => 'id'
                    ),

Jak w poście kolegi VEKIA uaktywniłem raportowanie i taki wyskoczył komunikat:

Impossible to add the product to the cart.
textStatus: 'parsererror'
errorThrown: 'SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data'
responseText:

Fatal error: Undefined class constant 'ROUND_TOTAL' in /sklep/classes/Cart.php on line 702

Ma ktos jakis pomysł jak sie pozbyć problemu ?

 

Wersja prestashop 1.6.1.1

Hosting home.pl   php: 5.4

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

2 answers to this question

Recommended Posts

  • 0

Witam

Dzięki za odpowiedź.

W międzyczasie znalazłem rozwiązanie...

Faktycznie w pliku classes/order.php nie było odpowiedniego wpisu...:

class OrderCore extends ObjectModel
{
	/** @var integer Delivery address id */
	public 		$id_address_delivery;

	/** @var integer Invoice address id */
	public 		$id_address_invoice;

	/** @var integer Cart id */
	public 		$id_cart;

	/** @var integer Currency id */
	public 		$id_currency;

Uzupełniłem go:

class OrderCore extends ObjectModel
{

    const ROUND_ITEM = 1;
    const ROUND_LINE = 2;
    const ROUND_TOTAL = 3;
	
	/** @var integer Delivery address id */
	public 		$id_address_delivery;

	/** @var integer Invoice address id */
	public 		$id_address_invoice;

	/** @var integer Cart id */
	public 		$id_cart;

	/** @var integer Currency id */
	public 		$id_currency;

i wszystko śmiga jak należy...

 

Najciekawsze jest to, że po zainstalowaniu wszystko działało i po kilku dniach padło... zaktualizowałem prestę do wersji 1.6.1.1 i znowu kilka dni chodziło i znowu padło...

Pytanie czy jest jakaś możliwość aby działało bez tego wpisu albo czy jakos ten wpis mógł się wykasować ??

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