Advertisement
Guest User

Шаблон1

a guest
Dec 29th, 2015
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.90 KB | None | 0 0
  1. <?php
  2.  
  3. if (! empty($result["result"]["access_buy"]))
  4.     return false;
  5.  
  6. if($result["row"]["empty_price"])
  7.     return false;
  8.  
  9. $action = '';
  10. if(! $result["result"]["cart_link"] || $result["row"]["no_buy"] || empty($result["row"]["count"]))
  11. {
  12.     $action = 'buy';
  13. }
  14.  
  15. echo '
  16. <form method="post" action="" class="js_shop_form shop_form ajax">
  17. <input type="hidden" name="good_id" value="'. $result["row"]["id"].'">
  18. <input type="hidden" name="module" value="shop">
  19. <input type="hidden" name="action" value="'.$action.'">';
  20.  
  21. if ($result["row"]["no_buy"] || empty($result["row"]["count"]))
  22. {
  23.     echo '<div class="js_shop_no_buy js_shop_no_buy_good shop_no_buy shop_no_buy_good">'.$this->diafan->_('Товар временно отсутствует').'</div>';
  24.     $hide_submit = true;
  25.     $waitlist = true;
  26. }
  27. if(! $result["result"]["cart_link"])
  28. {
  29.     $hide_submit = true;
  30. }
  31.  
  32. // у товара несколько цен
  33. if ($result["row"]["price_arr"])
  34. {
  35.     foreach ($result["row"]["price_arr"] as $price)
  36.     {
  37.         $param_code = '';
  38.         foreach ($price["param"] as $p)
  39.         {
  40.             if($p["value"])
  41.             {
  42.                 $param_code .= ' param'.$p["id"].'="'.$p["value"].'"';
  43.             }
  44.         }
  45.         if(! empty($price["image_rel"]))
  46.         {
  47.             $param_code .= ' image_id="'.$price["image_rel"].'"';
  48.         }
  49.         echo '<div class="js_shop_param_price shop_param_price shop-item-price"'.$param_code.'>';
  50.             echo '<span class="title">'.$this->diafan->_('Цена').':</span><span class="price">'.$price["price"].' '.$result["result"]["currency"];
  51.             if (!empty($price["old_price"]))
  52.             {
  53.                 echo '<span class="shop_old_price price-old"><span class="shop_price_value strike">'.$price["old_price"].' '.$result["result"]["currency"].'</span></span>';
  54.             }
  55.             if (! $price["count"] && empty($hide_submit) || empty($price["price_no_format"]) && ! $result['result']["buy_empty_price"])
  56.             {
  57.                 echo '<span class="js_shop_no_buy shop_no_buy">'.$this->diafan->_('Товар временно отсутствует').'</span>';
  58.                 $waitlist = true;
  59.             }
  60.             echo '</span>';
  61.         echo '</div>';
  62.     }
  63.  
  64.     echo '<div class="addict-field">';
  65.         echo '<div class="js_shop_form_param shop_form_param">';
  66.         foreach ($result["result"]["depends_param"] as $param)
  67.         {
  68.             if(! empty($result["row"]["param_multiple"][$param["id"]]))
  69.             {
  70.                 if(count($result["row"]["param_multiple"][$param["id"]]) == 1)
  71.                 {
  72.                     foreach ($result["row"]["param_multiple"][$param["id"]] as $value => $depend)
  73.                     {
  74.                         echo '<input type="hidden" name="param'.$param["id"].'" value="'.$value.'"'.($depend == 'depend' ? ' class="depend_param js_shop_depend_param"' : '').'>';
  75.                     }
  76.                 }
  77.                 else
  78.                 {
  79.                     $select = '';
  80.                     foreach ($param["values"] as $value)
  81.                     {
  82.                         if(! empty($result["row"]["param_multiple"][$param["id"]][$value["id"]]))
  83.                         {
  84.                             if(! $select)
  85.                             {
  86.                                 $select = ' '.$param["name"].' <select name="param'.$param["id"].'" class="shop-dropdown inpselect'.($result["row"]["param_multiple"][$param["id"]][$value["id"]] == 'depend' ? ' depend_param js_shop_depend_param' : '').'">';
  87.                             }
  88.  
  89.                             $select .= '<option value="'.$value["id"].'"'
  90.                             .(! empty($value["selected"]) ? ' selected' : '')
  91.                             .'>'.$value["name"].'</option>';
  92.                         }
  93.                     }
  94.                     if($select)
  95.                     {
  96.                         echo $select.'</select> ';
  97.                     }
  98.                 }
  99.             }
  100.         }
  101.         echo '</div>';
  102.     echo '</div>';
  103. }
  104. if(! empty($waitlist))
  105. {
  106.     echo '
  107.     <div class="js_shop_waitlist shop_waitlist">
  108.         '.$this->diafan->_('Сообщить когда появится на e-mail').'
  109.         <input type="email" name="mail" value="'.$this->diafan->_users->mail.'">
  110.         <input type="button" value="'.$this->diafan->_('Ок', false).'" action="wait">
  111.         <div class="errors error_waitlist" style="display:none"></div>
  112.     </div>';
  113. }
  114.  
  115. echo '<div class="js_shop_buy shop_buy to-cart">';
  116.     if (empty($result["row"]['is_file']) && empty($hide_submit))
  117.     {
  118.         echo '<input type="text" value="1" name="count" class="number" pattern="[0-9]+([\.|,][0-9]+)?" step="any">';
  119.     }
  120.     if(empty($hide_submit))
  121.     {
  122.         echo '<input type="button" class="button solid" value="'.$this->diafan->_('Купить', false).'" action="buy">';
  123.     }
  124. echo '</div>';
  125.  
  126. if(empty($hide_submit) && ! empty($result["result"]["one_click"]))
  127. {
  128.     echo '<span class="js_shop_one_click shop_one_click"><input type="button" value="'.$this->diafan->_('Купить в один клик', false).'" action="one_click"></span>';
  129. }
  130. echo '<div class="error"';
  131. if (! empty($result["row"]["count_in_cart"]))
  132. {
  133.     echo '>'.$this->diafan->_('В <a href="%s">корзине</a> %s шт.', true, BASE_PATH_HREF.$result["result"]["cart_link"], $result["row"]["count_in_cart"]);
  134. }
  135. else
  136. {
  137.     echo ' style="display:none;">';
  138. }
  139. echo '</div>';
  140. echo '</form>';
  141. //форма быстрого заказа
  142. if(! empty($result["result"]["one_click"]))
  143. {
  144.     $result["result"]["one_click"]["good_id"] = $result["row"]["id"];
  145.     echo $this->get('one_click', 'cart', $result["result"]["one_click"]);
  146. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement