2016-06-09 7 views
-1

So zeigen Sie die Kategorie ID in der Reihenfolge der Bestellung an Opencart 2.Kategorie ID in der Bestätigungsreihenfolge anzeigen

Vielen Dank.

image here

+0

einen schlechten Start in der Stack-Überlauf Community, die Sie zu vermeiden überprüfen Ich empfehle [Wie kann ich eine gute Frage zu stellen?]. Gute Fragen bringen gute Antworten, leider scheint dir deine Frage klar zu sein, aber das ist es nicht wirklich. – GaijinJim

Antwort

0

Sie tun müssen, die geändert folgen.

  1. Öffnen Sie die Datei catalog/controller/checkout/confirm.php. Suchen Sie die Zeile $this->load->model('extension/extension'); und fügen Sie diese danach hinzu. $this->load->model('catalog/product');

  2. Ersetzen Sie diese

    $data['products'][] = array(
         'key'  => $product['key'], 
         'product_id' => $product['product_id'], 
         'name'  => $product['name'], 
         'model'  => $product['model'], 
         'option'  => $option_data, 
         'recurring' => $recurring, 
         'quantity' => $product['quantity'], 
         'subtract' => $product['subtract'], 
         'price'  => $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id'], $this->config->get('config_tax'))), 
         'total'  => $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id'], $this->config->get('config_tax')) * $product['quantity']), 
         'href'  => $this->url->link('product/product', 'product_id=' . $product['product_id']), 
    ); 
    

DIESER VON

$cats = $this->model_catalog_product->getCatByProd($product['product_id']); 

$prefix = ''; 

foreach ($cats as $cat){ 
    $categories .= $prefix.$cat['category_id']; 
    $prefix = ', '; 
} 

    $data['products'][] = array(
      'key'  => $product['key'], 
      'product_id' => $product['product_id'], 
      'categories' => $categories, 
      'name'  => $product['name'], 
      'model'  => $product['model'], 
      'option'  => $option_data, 
      'recurring' => $recurring, 
      'quantity' => $product['quantity'], 
      'subtract' => $product['subtract'], 
      'price'  => $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id'], $this->config->get('config_tax'))), 
      'total'  => $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id'], $this->config->get('config_tax')) * $product['quantity']), 
      'href'  => $this->url->link('product/product', 'product_id=' . $product['product_id']), 
    ); 
  1. Öffnen Sie diese Datei catalog/model/catalog/product.php. Fügen Sie diese Funktion hinzu.

    public function getCatByProd($product_id) { 
    $query = $this->db->query("SELECT category_id FROM " . DB_PREFIX . "product_to_category WHERE product_id = '" . (int)$product_id . "'"); 
    
         return $query->rows; 
    } 
    
  2. Öffnen Sie diese Datei catalog\view\theme\default\template\checkout\confirm.tpl.

Ersetzen Sie diese

<a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a> 

DIESER

<a href="<?php echo $product['href']; ?>"><?php echo $product['name'].' ('.$product['categories'].')'; ?></a> 
+0

funktioniert nicht. In Schritt 6 wird diese Warnung angezeigt. https://yadi.sk/i/KwdfHInDsQnDE –

Verwandte Themen