Advertisement
Guest User

Untitled

a guest
Dec 8th, 2016
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 6.21 KB | None | 0 0
  1.                         <?php if ($product->get_stock_quantity() || $product->is_in_stock()): ?>
  2.                         <?php if ($product->product_type === 'variable'): ?>
  3.                             <form class="variations_form cart" method="POST" enctype="multipart/form-data"
  4.                               data-product_id="<?= absint($product->id) ?>"
  5.                               data-product_variations="<?= htmlspecialchars(json_encode($product->get_available_variations())) ?>">
  6.                         <?php else: ?>
  7.                             <form class="cart" method="post" enctype='multipart/form-data'>
  8.                         <?php endif; ?>
  9.                             <div class="row single_variation_wrap <?= $product->product_type === 'variable' ? 'variations' : '' ?>">
  10.                                 <?php if (!$product->is_sold_individually()) : ?>
  11.                                     <div class="col col-xs-12 col-md-4 col-lg-2 quantity">
  12.                                         <label>Ilość:</label>
  13.                                         <?php if ($product->product_type === 'variable'): ?>
  14.                                             <?php woocommerce_quantity_input(array(
  15.                                                 'input_value' => isset($_POST['quantity']) ? wc_stock_amount($_POST['quantity']) : 1,
  16.                                                 'min_value' => apply_filters('woocommerce_quantity_input_min', 1, $product)
  17.                                             )); ?>
  18.                                         <?php else: ?>
  19.                                             <?php woocommerce_quantity_input(array(
  20.                                                 'min_value' => apply_filters('woocommerce_quantity_input_min', 1, $product),
  21.                                                 'max_value' => apply_filters('woocommerce_quantity_input_max', $product->backorders_allowed() ? '' : $product->get_stock_quantity(), $product),
  22.                                                 'input_value' => isset($_POST['quantity']) ? wc_stock_amount($_POST['quantity']) : 1
  23.                                             )); ?>
  24.                                         <?php endif; ?>
  25.                                     </div>
  26.                                 <?php endif; ?>
  27.                                 <?php if ($product->product_type === 'variable'): ?>
  28.                                     <?php do_action('woocommerce_variable_add_to_cart'); ?>
  29.                                     <?php $prod_variations = $product->get_available_variations(); ?>
  30.                                     <?php foreach ($attributes as $attribute_name => $options):
  31.                                         if (!$options['is_variation']) continue;
  32.  
  33.                                         foreach ($prod_variations as $i => $d) {
  34.                                             if ($d['is_purchasable']) {
  35.                                                 foreach ($d['attributes'] as $ix => $dx) {
  36.                                                     $options[] = $dx;
  37.                                                 }
  38.                                             }
  39.                                         } ?>
  40.                                         <div class="col col-xs-12 col-md-4 col-lg-2">
  41.                                             <label
  42.                                                 for="<?= $attribute_name ?>"><?= wc_attribute_label($attribute_name); ?>
  43.                                                 :</label>
  44.                                             <?php $selected = false;/*isset( $_REQUEST[ 'attribute_' . sanitize_title( $attribute_name ) ] ) ? wc_clean( urldecode( $_REQUEST[ 'attribute_' . sanitize_title( $attribute_name ) ] ) ) : $product->get_variation_default_attribute( $attribute_name );*/ ?>
  45.                                             <?php wc_dropdown_variation_attribute_options(array('options' => $options, 'attribute' => $attribute_name, 'product' => $product, 'selected' => $selected, 'show_option_none' => 'Wybierz')) ?>
  46.                                         </div>
  47.                                     <?php endforeach; ?>
  48.                                     <div class="col col-xs-12 col-md-4 col-lg-3">
  49.                                         <div class="woocommerce-variation single_variation">
  50.                                             <div
  51.                                                 class="price"><?= $product->get_price_html_from_text() . wc_price($product->get_display_price()) ?></div>
  52.                                         </div>
  53.                                     </div>
  54.                                     <input type="hidden" name="product_id" value="<?= absint($product->id); ?>"/>
  55.                                     <input type="hidden" name="variation_id" class="variation_id" value="0"/>
  56.                                 <?php else: ?>
  57.                                     <div class="col col-xs-12 col-md-4 col-lg-3">
  58.                                         <div class="woocommerce-variation single_variation">
  59.                                             <div class="price"><?= wc_price($product->get_display_price()) ?></div>
  60.                                             <div class="hidden-price"><div class="price"><?= wc_price($product->get_display_price()) ?></div></div>
  61.                                         </div>
  62.                                     </div>
  63.                                 <?php endif; ?>
  64.  
  65.                                 <div class="col col-xs-12 col-md-4 col-lg-3">
  66.                                     <div class="cart_wrapper">
  67.                                         <button type="submit" class="add_to_cart single_add_to_cart_button button alt <?= $product->product_type === 'variable' ? 'disabled wc-variation-selection-needed' : '' ?>">
  68.                                             <i class="icon-shopping-cart"></i>Do koszyka
  69.                                         </button>
  70.                                     </div>
  71.                                     <input type="hidden" name="add-to-cart" value="<?= absint($product->id); ?>"/>
  72.                                 </div>
  73.                             </div>
  74.                         </form>
  75.                         <?php endif; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement