osben Posted January 22, 2012 Report Share Posted January 22, 2012 api/Products.phpв функции get_products ищем запрос $query = "SELECT p.id, p.url, p.brand_id, p.name, p.annotation, p.body, p.position, p.created as created, p.visible, p.featured, p.meta_title, p.meta_keywords, p.meta_description, b.name as brand, b.url as brand_url FROM __products p ......добавляем в SELECT выбор еще одного поля p.views и того выходит $query = "SELECT p.id, p.url, p.brand_id, p.name, p.annotation, p.body, p.position, p.created as created, p.visible, p.featured, p.meta_title, p.meta_keywords, p.meta_description, p.views, b.name as brand, b.url as brand_url FROM __products p ......в функции get_product тоже правим запрос $query = $this->db->placehold("SELECT DISTINCT p.id, p.url, p.brand_id, p.name, p.annotation, p.body, p.position, p.created as created, p.visible, p.featured, p.meta_title, p.meta_keywords, p.meta_description на $query = $this->db->placehold("SELECT DISTINCT p.id, p.url, p.brand_id, p.name, p.annotation, p.body, p.position, p.created as created, p.visible, p.featured, p.meta_title, p.meta_keywords, p.meta_description, p.views также в этом классе добавляем функцию /** * Функция вносит +1 к просмотру товара * @param $id * @retval object */ public function update_views($id) { $this->db->query("UPDATE __products SET views=views+1 WHERE id=?", $id); return true; } В phpmyadmin выполняем запрос к БД ALTER TABLE `s_products` ADD `views` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0' AFTER `featured`правим view/ProductView.phpПосле // Выбираем товар из базы $product = $this->products->get_product((string)$product_url); if(empty($product) || (!$product->visible && empty($_SESSION['admin']))) return false;добавляем if($product->visible && empty($_SESSION['admin'])) $this->products->update_views($product->id); Правки в шаблоне:product.tpl и products.tplв удобном для Вас месте добавляем <!-- Просмотров --> <small>Просмотров: {$product->views}</small> <!-- Просмотров (The End) --> Quote Link to post Share on other sites
Kpoxa Posted January 22, 2012 Report Share Posted January 22, 2012 - страница всех брендовну это уже выложено Quote Link to post Share on other sites
osben Posted January 22, 2012 Author Report Share Posted January 22, 2012 видал, но я хотел чють модернуть, что бы к бренду выводились категории в которых он представлен Quote Link to post Share on other sites
nwnet Posted January 22, 2012 Report Share Posted January 22, 2012 А что-же никому не требовалось более актуальные вещи сделать напр. поиск по артикулу или суммарное кол-во товаров в заказе в админке?))) Quote Link to post Share on other sites
osben Posted January 22, 2012 Author Report Share Posted January 22, 2012 Мне лично нет. Рейтинг уже готов, сразу скажу, инструкции слабые пишу, так как нету времени писаниной заниматса, да и не платит за это не кто...Сейчас залью на файл обменник и дам линк Quote Link to post Share on other sites
weranda Posted February 23, 2012 Report Share Posted February 23, 2012 Месяц прошел Где ссылка? Quote Link to post Share on other sites
osben Posted February 27, 2012 Author Report Share Posted February 27, 2012 а ты поищи соответствующий тему Quote Link to post Share on other sites
kabal Posted March 17, 2012 Report Share Posted March 17, 2012 у себя в движке не нашел и близко похожих путей и файлов. подскажите новичку что править в этом случае? (выведу необходимую информацию) Quote Link to post Share on other sites
kabal Posted March 19, 2012 Report Share Posted March 19, 2012 нашел, спасибо за скрипт. весь код правда лежал не в этих конкретных файлах. Quote Link to post Share on other sites
Clean Posted March 21, 2012 Report Share Posted March 21, 2012 страница отзывов о магазине интересная штука. Quote Link to post Share on other sites
zhenyaweb Posted October 23, 2012 Report Share Posted October 23, 2012 Выводится 0 просмотров. Даже после обновления страницы Quote Link to post Share on other sites
admsk Posted November 3, 2012 Report Share Posted November 3, 2012 ссылку на скрипт можно Quote Link to post Share on other sites
Slavik911 Posted November 7, 2012 Report Share Posted November 7, 2012 и у меня тоже 0 Quote Link to post Share on other sites
Slavik911 Posted November 7, 2012 Report Share Posted November 7, 2012 разобрался, нужно не через сессию админа заходить Quote Link to post Share on other sites
Danya Posted November 22, 2012 Report Share Posted November 22, 2012 osben Это решения для вывода просмотров товара на сайте?А для админки данное решение подойдёт?Чтобы в админке в каталоге возле каждого товара выводило:Просмотров товара на сайте: 563 Quote Link to post Share on other sites
Danya Posted November 22, 2012 Report Share Posted November 22, 2012 Вот такого вида: Quote Link to post Share on other sites
osben Posted November 22, 2012 Author Report Share Posted November 22, 2012 да, {$product->views} доступен и в админке Quote Link to post Share on other sites
Danya Posted November 22, 2012 Report Share Posted November 22, 2012 спасибо большущее! Quote Link to post Share on other sites
sandel Posted December 1, 2012 Report Share Posted December 1, 2012 от меня тоже спасибо большое !!! хорошее дополнение для статистики Quote Link to post Share on other sites
pikasso Posted January 4, 2013 Report Share Posted January 4, 2013 Ребята прошу пишите под какую версию скрипты выкладываете! а то я так чуть не убил сайт! Quote Link to post Share on other sites
maksam07 Posted January 4, 2013 Report Share Posted January 4, 2013 и можно добавить код в bbcode. Quote Link to post Share on other sites
calvin Posted January 27, 2013 Report Share Posted January 27, 2013 Нашёл ещё недоработку - когда товар копируешь (дублируешь), то копируется и кол-во просмотров (а у нового овара д.б. кол-во просмотров = 0).Где что надо исправить? Quote Link to post Share on other sites
delprofile Posted January 27, 2013 Report Share Posted January 27, 2013 келвин если не ошибаюсь то не поправишь он дубль делает строки. Quote Link to post Share on other sites
calvin Posted January 27, 2013 Report Share Posted January 27, 2013 Заменил в api/products.php // Очищаем url $this->db->query('UPDATE __products SET url="" WHERE id=?', $new_id);на // Очищаем url и views $this->db->query('UPDATE __products SET url="", views=0 WHERE id=?', $new_id);Вроде работает ... Quote Link to post Share on other sites
Danya Posted January 27, 2013 Report Share Posted January 27, 2013 да, работает. спасибо calvin Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.