Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

inoplanetny

Newbie
  
  • Posts

    7
  • Joined

  • Last visited

1 Follower

About inoplanetny

  • Birthday 07/20/1988

Information

  • Gender
    Мужчина
  • City:
    Ставрополь

inoplanetny's Achievements

Rookie

Rookie (2/14)

  • First Post
  • Week One Done
  • One Month Later
  • One Year In
  • Conversation Starter

Recent Badges

0

Reputation

  1. public function getProductSpecial($product_id) { if ($this->customer->isLogged()) { $customer_group_id = $this->customer->getCustomerGroupId(); } else { $customer_group_id = $this->config->get('config_customer_group_id'); } $query = $this->db->query("SELECT price FROM " . DB_PREFIX . "product_special WHERE product_id = '" . (int)$product_id . "' AND customer_group_id = '" . (int)$customer_group_id . "' AND ((date_start = '0000-00-00' OR date_start < NOW()) AND (date_end = '0000-00-00' OR date_end > NOW())) ORDER BY priority ASC, price ASC LIMIT 1"); if ($query->num_rows) { return $query->row['price']; } else { return FALSE; } }
  2. с Вашим кодом всё работает! ;) Но в "catalog/controller/product.php" у меня немного другой код, т.к. добавил это: https://opencartforum.com/topic/2004-спецпредложения-скидка-в-процентах/, в итоге, изменив "catalog/model/catalog/product.php", а "catalog/controller/product.php" оставив как есть, вылетает: Fatal error: Unsupported operand types in ***/system/library/currency.php on line 70. А код следующий, ковыряю уже часа полтора :( if ($discount) { $this->data['price'] = $this->currency->format($this->tax->calculate($product_info['price'], $product_info['tax_class_id'], $this->config->get('config_tax'))); $this->data['special'] = FALSE; } else { $this->data['price'] = $this->currency->format($this->tax->calculate($product_info['price'], $product_info['tax_class_id'], $this->config->get('config_tax'))); $special = $this->model_catalog_product->getProductSpecial($this->request->get['product_id']); $GLOBALS["special_clean"] = $special; if ($special < 1) {$special = (int)($product_info['price'] * $special); $special = round($special,-1);} // наша строка для расчета скидки в процентах if ($special) { $this->data['special'] = $this->currency->format($this->tax->calculate($special, $product_info['tax_class_id'], $this->config->get('config_tax'))); //$this->data['price'] = $product_info['price']; $this->data['price'] = $this->currency->format($this->tax->calculate($product_info['price'], $product_info['tax_class_id'], $this->config->get('config_tax'))); } else { $this->data['special'] = FALSE; } } В шаблоне вывожу следующую строку: if (isset($special) and $special !=0) { $percent = (1 - $GLOBALS["special_clean"])*100; echo "</br></br><p class='skidka'>".$text_skidka." ".round($percent)."%</br>до ".$special_date_end."</p>"; }
  3. Большое спасибо! Появился ещё один вопрос, как вывести (там же) дату окончания действия спец. предложения?
  4. Прошу прощения ). Установлена ocStore 0.2.2. Шаблон default. На странице продукта (например, /index.php?route=product/product&path=46_48&product_id=59) пытаюсь вывести значение $price, в том виде, в котором она хранится в БД. Выводится с запятой и словом "руб" (8,500.00 руб). А требуется вывести как в БД - 8500.0000.
  5. Помогите, пожалуйста, вывести цену продукта (на его странице) в первоначальном виде, т.е. "8950.0000", а не "8,950.00 р.". Может быть в PHP есть какая-либо функция? :unsure:
  6. Решение Очень помогло, большое Вам спасибо!! У себя сделал округление цен в бОльшую сторону if ($special < 1) $special = (int)($result['price'] * $special); $special = round($special,-1); // наша строка для расчета скидки в процентах А в корзине так: $product_special_query = $this->db->query("SELECT price FROM " . DB_PREFIX . "product_special WHERE product_id = '" . (int)$product_id . "' AND customer_group_id = '" . (int)$customer_group_id . "' AND ((date_start = '0000-00-00' OR date_start < NOW()) AND (date_end = '0000-00-00' OR date_end > NOW())) ORDER BY priority ASC, price ASC LIMIT 1"); if ($product_special_query->num_rows) { if ($product_special_query->row['price'] < 1) $price = (int)($product_query->row['price'] * $product_special_query->row['price']); // это две новых строки else $price = $product_special_query->row['price']; $price = round($price,-1); // это две новых строки } else { $price = $product_query->row['price']; } }
  7. приведенный Fix305 код, на моей ocstore 0.2.2 выдает только один товар в квитанции, как вывести Все заказанные позиции?
  8. Почему бы не написать «Привет»?

Guest
×
  • Create New...

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.