Warning: Cannot use a scalar value as an array in /home/admin/public_html/forum/include/fm.class.php on line 757

Warning: Invalid argument supplied for foreach() in /home/admin/public_html/forum/include/fm.class.php on line 770

Warning: Invalid argument supplied for foreach() in /home/admin/public_html/forum/topic.php on line 737
Форумы портала PHP.SU :: Какие переменные передаются на сервер?

 PHP.SU

Программирование на PHP, MySQL и другие веб-технологии
PHP.SU Портал     На главную страницу форума Главная     Помощь Помощь     Поиск Поиск     Поиск Яндекс Поиск Яндекс     Вакансии  Пользователи Пользователи


 Страниц (1): [1]   

> Без описания
Batis
Отправлено: 23 Февраля, 2016 - 05:21:05
Post Id


Новичок


Покинул форум
Сообщений всего: 8
Дата рег-ции: Дек. 2008  


Помог: 0 раз(а)




Дорогие товарищи.

Возникла проблема в интернет магазине. http://www[dot]xn---96-eddjhv7d[dot]xn--p1ai/

Модуль акции не добавляет товар в корзину.

Вопрос как я могу посмотреть, что передает php на сервер при нажатии на кнопку? (Какие передались?)

это сами кнопки в шаблоне.

CODE (htmlphp):
скопировать код в буфер обмена
  1. <div class="btn-group">
  2.                     <button type="button" class="btn btn-default" onclick="cart.add('<?php echo $product['product_id']; ?>', '<?php echo $product['minimum']; ?>');"><?php echo $button_cart; ?></button>
  3.                     <button type="button" class="btn btn-default" data-toggle="tooltip" title="<?php echo $button_wishlist; ?>" onclick="wishlist.add('<?php echo $product['product_id']; ?>');"><i class="fa fa-heart"></i></button>
  4.                     <button type="button" class="btn btn-default" data-toggle="tooltip" title="<?php echo $button_compare; ?>" onclick="compare.add('<?php echo $product['product_id']; ?>');"><i class="fa fa-bar-chart"></i></button>
  5.                 </div>


контроллер.

PHP:
скопировать код в буфер обмена
  1. class ControllerProductSpecial extends Controller {
  2. public function index() {
  3. $this->load->language('product/special');
  4. $this->load->model('catalog/product');
  5. $this->load->model('tool/image');
  6. if (isset($this->request->get['sort'])) {
  7. $sort = $this->request->get['sort'];
  8. } else {
  9. $sort = 'p.sort_order';
  10. }
  11. if (isset($this->request->get['order'])) {
  12. $order = $this->request->get['order'];
  13. } else {
  14. $order = 'ASC';
  15. }
  16. if (isset($this->request->get['page'])) {
  17. $page = $this->request->get['page'];
  18. } else {
  19. $page = 1;
  20. }
  21. if (isset($this->request->get['limit'])) {
  22. $limit = (int)$this->request->get['limit'];
  23. } else {
  24. $limit = $this->config->get('config_product_limit');
  25. }
  26. $this->document->setTitle($this->language->get('heading_title'));
  27. $data['breadcrumbs'] = array();
  28. $data['breadcrumbs'][] = array(
  29. 'text' => $this->language->get('text_home'),
  30. 'href' => $this->url->link('common/home')
  31. );
  32. $url = '';
  33. if (isset($this->request->get['sort'])) {
  34. $url .= '&sort=' . $this->request->get['sort'];
  35. }
  36. if (isset($this->request->get['order'])) {
  37. $url .= '&order=' . $this->request->get['order'];
  38. }
  39. if (isset($this->request->get['page'])) {
  40. $url .= '&page=' . $this->request->get['page'];
  41. }
  42. if (isset($this->request->get['limit'])) {
  43. $url .= '&limit=' . $this->request->get['limit'];
  44. }
  45. $data['breadcrumbs'][] = array(
  46. 'text' => $this->language->get('heading_title'),
  47. 'href' => $this->url->link('product/special', $url)
  48. );
  49. $data['heading_title'] = $this->language->get('heading_title');
  50. $data['text_empty'] = $this->language->get('text_empty');
  51. $data['text_quantity'] = $this->language->get('text_quantity');
  52. $data['text_manufacturer'] = $this->language->get('text_manufacturer');
  53. $data['text_model'] = $this->language->get('text_model');
  54. $data['text_price'] = $this->language->get('text_price');
  55. $data['text_tax'] = $this->language->get('text_tax');
  56. $data['text_points'] = $this->language->get('text_points');
  57. $data['text_compare'] = sprintf($this->language->get('text_compare'), (isset($this->session->data['compare']) ? count($this->session->data['compare']) : 0));
  58. $data['text_sort'] = $this->language->get('text_sort');
  59. $data['text_limit'] = $this->language->get('text_limit');
  60. $data['button_cart'] = $this->language->get('button_cart');
  61. $data['button_wishlist'] = $this->language->get('button_wishlist');
  62. $data['button_compare'] = $this->language->get('button_compare');
  63. $data['button_list'] = $this->language->get('button_list');
  64. $data['button_grid'] = $this->language->get('button_grid');
  65. $data['button_continue'] = $this->language->get('button_continue');
  66. $data['compare'] = $this->url->link('product/compare');
  67. $data['products'] = array();
  68. $filter_data = array(
  69. 'sort' => $sort,
  70. 'order' => $order,
  71. 'start' => ($page - 1) * $limit,
  72. 'limit' => $limit
  73. );
  74. $product_total = $this->model_catalog_product->getTotalProductSpecials();
  75. $results = $this->model_catalog_product->getProductSpecials($filter_data);
  76. foreach ($results as $result) {
  77. if ($result['image']) {
  78. $image = $this->model_tool_image->resize($result['image'], $this->config->get('config_image_product_width'), $this->config->get('config_image_product_height'));
  79. } else {
  80. $image = $this->model_tool_image->resize('placeholder.png', $this->config->get('config_image_product_width'), $this->config->get('config_image_product_height'));
  81. }
  82. if (($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) {
  83. $price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')));
  84. } else {
  85. $price = false;
  86. }
  87. if ((float)$result['special']) {
  88. $special = $this->currency->format($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax')));
  89. } else {
  90. $special = false;
  91. }
  92. if ($this->config->get('config_tax')) {
  93. $tax = $this->currency->format((float)$result['special'] ? $result['special'] : $result['price']);
  94. } else {
  95. $tax = false;
  96. }
  97. if ($this->config->get('config_review_status')) {
  98. $rating = (int)$result['rating'];
  99. } else {
  100. $rating = false;
  101. }
  102. $data['products'][] = array(
  103. 'product_id' => $result['product_id'],
  104. 'thumb' => $image,
  105. 'name' => $result['name'],
  106. 'description' => utf8_substr(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8')), 0, $this->config->get('config_product_description_length')) . '..',
  107. 'price' => $price,
  108. 'special' => $special,
  109. 'tax' => $tax,
  110. 'minimum' => $result['minimum'] > 0 ? $result['minimum'] : 1,
  111. 'rating' => $result['rating'],
  112. 'href' => $this->url->link('product/product', 'product_id=' . $result['product_id'] . $url)
  113. );
  114. }
  115. $url = '';
  116. if (isset($this->request->get['limit'])) {
  117. $url .= '&limit=' . $this->request->get['limit'];
  118. }
  119. $data['sorts'] = array();
  120. $data['sorts'][] = array(
  121. 'text' => $this->language->get('text_default'),
  122. 'value' => 'p.sort_order-ASC',
  123. 'href' => $this->url->link('product/special', 'sort=p.sort_order&order=ASC' . $url)
  124. );
  125. $data['sorts'][] = array(
  126. 'text' => $this->language->get('text_name_asc'),
  127. 'value' => 'pd.name-ASC',
  128. 'href' => $this->url->link('product/special', 'sort=pd.name&order=ASC' . $url)
  129. );
  130. $data['sorts'][] = array(
  131. 'text' => $this->language->get('text_name_desc'),
  132. 'value' => 'pd.name-DESC',
  133. 'href' => $this->url->link('product/special', 'sort=pd.name&order=DESC' . $url)
  134. );
  135. $data['sorts'][] = array(
  136. 'text' => $this->language->get('text_price_asc'),
  137. 'value' => 'ps.price-ASC',
  138. 'href' => $this->url->link('product/special', 'sort=ps.price&order=ASC' . $url)
  139. );
  140. $data['sorts'][] = array(
  141. 'text' => $this->language->get('text_price_desc'),
  142. 'value' => 'ps.price-DESC',
  143. 'href' => $this->url->link('product/special', 'sort=ps.price&order=DESC' . $url)
  144. );
  145. if ($this->config->get('config_review_status')) {
  146. $data['sorts'][] = array(
  147. 'text' => $this->language->get('text_rating_desc'),
  148. 'value' => 'rating-DESC',
  149. 'href' => $this->url->link('product/special', 'sort=rating&order=DESC' . $url)
  150. );
  151. $data['sorts'][] = array(
  152. 'text' => $this->language->get('text_rating_asc'),
  153. 'value' => 'rating-ASC',
  154. 'href' => $this->url->link('product/special', 'sort=rating&order=ASC' . $url)
  155. );
  156. }
  157. $data['sorts'][] = array(
  158. 'text' => $this->language->get('text_model_asc'),
  159. 'value' => 'p.model-ASC',
  160. 'href' => $this->url->link('product/special', 'sort=p.model&order=ASC' . $url)
  161. );
  162. $data['sorts'][] = array(
  163. 'text' => $this->language->get('text_model_desc'),
  164. 'value' => 'p.model-DESC',
  165. 'href' => $this->url->link('product/special', 'sort=p.model&order=DESC' . $url)
  166. );
  167. $url = '';
  168. if (isset($this->request->get['sort'])) {
  169. $url .= '&sort=' . $this->request->get['sort'];
  170. }
  171. if (isset($this->request->get['order'])) {
  172. $url .= '&order=' . $this->request->get['order'];
  173. }
  174. $data['limits'] = array();
  175. $limits = array_unique(array($this->config->get('config_product_limit'), 25, 50, 75, 100));
  176. sort($limits);
  177. foreach($limits as $value) {
  178. $data['limits'][] = array(
  179. 'text' => $value,
  180. 'value' => $value,
  181. 'href' => $this->url->link('product/special', $url . '&limit=' . $value)
  182. );
  183. }
  184. $url = '';
  185. if (isset($this->request->get['sort'])) {
  186. $url .= '&sort=' . $this->request->get['sort'];
  187. }
  188. if (isset($this->request->get['order'])) {
  189. $url .= '&order=' . $this->request->get['order'];
  190. }
  191. if (isset($this->request->get['limit'])) {
  192. $url .= '&limit=' . $this->request->get['limit'];
  193. }
  194. $pagination = new Pagination();
  195. $pagination->total = $product_total;
  196. $pagination->page = $page;
  197. $pagination->limit = $limit;
  198. $pagination->url = $this->url->link('product/special', $url . '&page={page}');
  199. $data['pagination'] = $pagination->render();
  200. $data['results'] = sprintf($this->language->get('text_pagination'), ($product_total) ? (($page - 1) * $limit) + 1 : 0, ((($page - 1) * $limit) > ($product_total - $limit)) ? $product_total : ((($page - 1) * $limit) + $limit), $product_total, ceil($product_total / $limit));
  201. // http://googlewebmast...nd-relprev.html
  202. if ($page == 1) {
  203. $this->document->addLink($this->url->link('product/special', '', 'SSL'), 'canonical');
  204. } elseif ($page == 2) {
  205. $this->document->addLink($this->url->link('product/special', '', 'SSL'), 'prev');
  206. } else {
  207. $this->document->addLink($this->url->link('product/special', 'page='. ($page - 1), 'SSL'), 'prev');
  208. }
  209. if ($limit && ceil($product_total / $limit) > $page) {
  210. $this->document->addLink($this->url->link('product/special', 'page='. ($page + 1), 'SSL'), 'next');
  211. }
  212. $data['sort'] = $sort;
  213. $data['order'] = $order;
  214. $data['limit'] = $limit;
  215. $data['continue'] = $this->url->link('common/home');
  216. $data['column_left'] = $this->load->controller('common/column_left');
  217. $data['column_right'] = $this->load->controller('common/column_right');
  218. $data['content_top'] = $this->load->controller('common/content_top');
  219. $data['content_bottom'] = $this->load->controller('common/content_bottom');
  220. $data['footer'] = $this->load->controller('common/footer');
  221. $data['header'] = $this->load->controller('common/header');
  222. if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/product/special.tpl')) {
  223. $this->response->setOutput($this->load->view($this->config->get('config_template') . '/template/product/special.tpl', $data));
  224. } else {
  225. $this->response->setOutput($this->load->view('default/template/product/special.tpl', $data));
  226. }
  227. }
  228. }

(Отредактировано автором: 23 Февраля, 2016 - 05:21:57)

 
 Top
Viper
Отправлено: 23 Февраля, 2016 - 09:36:35
Post Id



Активный участник


Покинул форум
Сообщений всего: 4555
Дата рег-ции: Февр. 2007  
Откуда: Симферополь


Помог: 98 раз(а)




Перед $this->load->language('product/special'); добавить
PHP:
скопировать код в буфер обмена
  1. echo '<pre>';
  2. print_r($_REQUEST);
  3. echo '</pre>';


-----
Список фильмов с описанием, блекджеком и... для Joomla? -> https://киноархив[dot]com
Демо нового движка для сайта php.su -> php[dot]su, проект на гитхабе
 
 Top
Batis
Отправлено: 23 Февраля, 2016 - 12:37:30
Post Id


Новичок


Покинул форум
Сообщений всего: 8
Дата рег-ции: Дек. 2008  


Помог: 0 раз(а)




[quote=Viper][/quote]

Никаких изменений. не показывается.
 
 Top
Viper
Отправлено: 23 Февраля, 2016 - 18:05:32
Post Id



Активный участник


Покинул форум
Сообщений всего: 4555
Дата рег-ции: Февр. 2007  
Откуда: Симферополь


Помог: 98 раз(а)




Batis пишет:
Никаких изменений. не показывается.
уверены что метод index вызывается? И вообще ли этот контроллер вызывается?


-----
Список фильмов с описанием, блекджеком и... для Joomla? -> https://киноархив[dot]com
Демо нового движка для сайта php.su -> php[dot]su, проект на гитхабе
 
 Top
andrewkard
Отправлено: 23 Февраля, 2016 - 18:18:58
Post Id


Участник


Покинул форум
Сообщений всего: 1372
Дата рег-ции: Нояб. 2014  


Помог: 30 раз(а)




Посмотрите в консоли, вкладка Сеть. Что передается и куда.
 
 Top
Batis
Отправлено: 24 Февраля, 2016 - 11:49:38
Post Id


Новичок


Покинул форум
Сообщений всего: 8
Дата рег-ции: Дек. 2008  


Помог: 0 раз(а)




andrewkard пишет:
Посмотрите в консоли, вкладка Сеть. Что передается и куда.


Что передается найдено. А куда не могу понять где указывается.

CODE (htmlphp):
скопировать код в буфер обмена
  1. {"success":"<a href=\"http:\/\/www.\u0434\u0432\u0435\u0440\u0438-96.\u0440\u0444\/index.php?route=product\/product&product_id=456\">\u041c\u0430\u0441\u0442\u0435\u0440 636 \u0414\u0443\u0431 \u0431\u0435\u043b\u0435\u043d\u044b\u0439 (\u0410\u0440\u0442. 5019)<\/a> \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d <a href=\"http:\/\/www.\u0434\u0432\u0435\u0440\u0438-96.\u0440\u0444\/index.php?route=checkout\/cart\">\u0432 \u043a\u043e\u0440\u0437\u0438\u043d\u0443 \u043f\u043e\u043a\u0443\u043f\u043e\u043a<\/a>!","total":"0"}


или сюда все таки уходит?

CODE (htmlphp):
скопировать код в буфер обмена
  1. Request URL:http://www.xn---96-eddjhv7d.xn--p1ai/index.php?route=checkout/cart/add

(Отредактировано автором: 24 Февраля, 2016 - 11:51:04)

 
 Top
andrewkard
Отправлено: 24 Февраля, 2016 - 11:59:05
Post Id


Участник


Покинул форум
Сообщений всего: 1372
Дата рег-ции: Нояб. 2014  


Помог: 30 раз(а)




Batis пишет:
или сюда все таки уходит?

Если по этой кнопке:
Batis пишет:
<button type="button" class="btn btn-default" onclick="cart.add('<?php echo $product['product_id']; ?>', '<?php echo $product['minimum']; ?>');"><?php echo $button_cart; ?></button>

то вполне вероятно.
 
 Top
Страниц (1): [1]
Сейчас эту тему просматривают: 0 (гостей: 0, зарегистрированных: 0)
« Вопросы новичков »


Все гости форума могут просматривать этот раздел.
Только зарегистрированные пользователи могут создавать новые темы в этом разделе.
Только зарегистрированные пользователи могут отвечать на сообщения в этом разделе.
 



Powered by PHP  Powered By MySQL  Powered by Nginx  Valid CSS  RSS

 
Powered by ExBB FM 1.0 RC1. InvisionExBB