Modify

Opened 10 years ago

Closed 6 years ago

#842 closed Aufgabe (fixed)

ShoppingCart - bitte reset, each, list, while durch foreach ersetzen

Reported by: INETvisio Owned by: somebody
Priority: niedrig Milestone: modified-shop-2.0.5.0
Component: Shop Version: 2.0.0.0
Keywords: Cc:
Blocked By: Blocking:

Description

Hallo modified,

mit der Modulerweiterung habe ich ein Problem entdeckt, dass man die ShoppingCart-Funktionen bei der Preisanpassungen nicht nutzen darf. Sonst wird der ArrayZeiger zurückgesetzt und die Schleife kann Produkte verlieren.
Beispiel-Position:
Zeile 91:

            //new module support    
            $sql_data_array = $this->shoppingCartModules->restore_contents_products_db($sql_data_array,$products_id,$this->table_basket,$qty,$this->type);

Wenn ein Modul eine Prüfung über die Produkte machen möchte, wird der ArrayZeiger verändert.

 $product_ids = $_SESSION['cart']->get_product_id_list();

Mein Vorschlag wäre es, alle while-list-each Schleifen durch foreach Schleifen zu ersetzen. Foreach ist sicherer und schneller.
Beispiel:
suchen

    if (is_array($this->contents)) {
      reset($this->contents);
      while (list ($products_id,) = each($this->contents)) {

ersetzen

    if (is_array($this->contents)) {
      foreach ($this->contents AS $products_id => $value) {

usw.

Gruß
Jürgen H.

Attachments (0)

Change History (3)

comment:1 by Torsten Riemer, 8 years ago

Milestone: modified-shop-2.1.0.0

comment:3 by Gerhard Waldemair, 6 years ago

Milestone: modified-shop-2.0.5.0

comment:4 by Gerhard Waldemair, 6 years ago

Resolution: fixed
Status: newclosed

In 11561:

update for php 7.3 - fix #842

Modify Ticket

Action
as closed The owner will remain somebody.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.