Модуль Несколько инструкций

soslow

Писатель
Регистрация
19 Июн 2014
Сообщения
3
Реакции
3
Несколько инструкций
 

Вложения

  • Автоматически сгенерированные связанные товары.pdf
    116 KB · Просмотры: 73
  • Закупочная цена в админке.pdf
    315,6 KB · Просмотры: 73
  • Модуль для доп. продаж в корзине.pdf
    654,9 KB · Просмотры: 93
неуверен на сто процентов, но модули простенькие и должны работать независимо от версии симплы
 
Здравствуйте, помогите, пожалуйста, решить проблему с синтаксисом языка. Выводится сообщение: syntax error, unexpected T_STRING
Строка выделенная жирным.

Код:
else { // генерируемые связанные товары
            $products->categories = $this->categories->get_categories(array('product_id'=>$product->id));
            $category = reset($products->categories);
            $related_products = array();
            $after = false;
            $products = $this->products->get_products(array('category_id' => $category->id, 'limit' => 100, 'in_stock'=>1, 'visible'=>1));
            foreach($products as $p)
            {
            if($after && count($related_products) < 6)
            $related_products[$p->id] = $p;
            elseif($p->id == $product->id)
            $after = true;
            }
            if(count($related_products) < 6)
            foreach($products as $p)
            if($p->id != $product->id && count($related_products) < 6)
            $related_products[$p->id] = $p;
            else break;
            $related_products_images = $this->products->get_images(array('product_id'=>array_keys($related_products)));
            foreach($related_products_images as $related_product_image)
            if(isset($related_products[$related_product_image->product_id]))
            $related_products[$related_product_image->product_id]->images[] = $related_product_image;
            $related_products_variants = $this->variants->get_variants(array('product_id'=>array_keys($related_products), 'instock'=>true));
            foreach($related_products_variants as $related_product_variant)
            {
            if(isset($related_products[$related_product_variant->product_id]))
            {
            $related_product_variant->price *= (100-$discount)/100;
            $related_products[$related_product_variant->product_id]->variants[] = $related_product_variant;
            }
            }
            foreach($related_products as $r)
            {
            $r->image = &$r->images[0];
            $r->variant = &$r->variants[0];
            }
            $this->design->assign('related_products', $related_products);
            } // end: генерируемые связанные товары
 
Последнее редактирование модератором:
Здравствуйте, помогите, пожалуйста, решить проблему с синтаксисом языка. Выводится сообщение: syntax error, unexpected T_STRING
Строка выделенная жирным.

Код:
else { // генерируемые связанные товары
            $products->categories = $this->categories->get_categories(array('product_id'=>$product->id));
            $category = reset($products->categories);
            $related_products = array();
            $after = false;
            $products = $this->products->get_products(array('category_id' => $category->id, 'limit' => 100, 'in_stock'=>1, 'visible'=>1));
            foreach($products as $p)
            {
            if($after && count($related_products) < 6)
            $related_products[$p->id] = $p;
            elseif($p->id == $product->id)
            $after = true;
            }
            if(count($related_products) < 6)
            foreach($products as $p)
            if($p->id != $product->id && count($related_products) < 6)
            $related_products[$p->id] = $p;
            else break;
            $related_products_images = $this->products->get_images(array('product_id'=>array_keys($related_products)));
            foreach($related_products_images as $related_product_image)
            if(isset($related_products[$related_product_image->product_id]))
            $related_products[$related_product_image->product_id]->images[] = $related_product_image;
            $related_products_variants = $this->variants->get_variants(array('product_id'=>array_keys($related_products), 'instock'=>true));
            foreach($related_products_variants as $related_product_variant)
            {
            if(isset($related_products[$related_product_variant->product_id]))
            {
            $related_product_variant->price *= (100-$discount)/100;
            $related_products[$related_product_variant->product_id]->variants[] = $related_product_variant;
            }
            }
            foreach($related_products as $r)
            {
            $r->image = &$r->images[0];
            $r->variant = &$r->variants[0];
            }
            $this->design->assign('related_products', $related_products);
            } // end: генерируемые связанные товары
в какой строке , я проверил у меня работает
 
Здравствуйте, помогите, пожалуйста, решить проблему с синтаксисом языка. Выводится сообщение: syntax error, unexpected T_STRING
Строка выделенная жирным.

Код:
else { // генерируемые связанные товары
            $products->categories = $this->categories->get_categories(array('product_id'=>$product->id));
            $category = reset($products->categories);
            $related_products = array();
            $after = false;
            $products = $this->products->get_products(array('category_id' => $category->id, 'limit' => 100, 'in_stock'=>1, 'visible'=>1));
            foreach($products as $p)
            {
            if($after && count($related_products) < 6)
            $related_products[$p->id] = $p;
            elseif($p->id == $product->id)
            $after = true;
            }
            if(count($related_products) < 6)
            foreach($products as $p)
            if($p->id != $product->id && count($related_products) < 6)
            $related_products[$p->id] = $p;
            else break;
            $related_products_images = $this->products->get_images(array('product_id'=>array_keys($related_products)));
            foreach($related_products_images as $related_product_image)
            if(isset($related_products[$related_product_image->product_id]))
            $related_products[$related_product_image->product_id]->images[] = $related_product_image;
            $related_products_variants = $this->variants->get_variants(array('product_id'=>array_keys($related_products), 'instock'=>true));
            foreach($related_products_variants as $related_product_variant)
            {
            if(isset($related_products[$related_product_variant->product_id]))
            {
            $related_product_variant->price *= (100-$discount)/100;
            $related_products[$related_product_variant->product_id]->variants[] = $related_product_variant;
            }
            }
            foreach($related_products as $r)
            {
            $r->image = &$r->images[0];
            $r->variant = &$r->variants[0];
            }
            $this->design->assign('related_products', $related_products);
            } // end: генерируемые связанные товары

Версия PHP должна быть 5.6
 
Назад
Сверху