<?php foreach ($attribute->getOptions() as $option) { /** @var $option Attribute\Option */ ?> <?php Forms::checkbox(array('name' => 'product[attributes][' . $attribute->getId() . '][options]', 'id' => 'product_attributes_' . $attribute->getId() . '_option_' . $option->getId(), 'classes' => array('attribute-' . $attribute->getId()), 'label' => $option->getLabel(), 'value' => apply_filters('jigoshop\\template\\admin\\product\\attribute\\multiselect\\value', $option->getId(), $attribute, $option), 'multiple' => true, 'checked' => in_array($option->getId(), $attribute->getValue()))); ?> <?php } ?> <?php break; case Attribute\Select::TYPE: ?> <div class="panel-body"><?php Forms::select(array('name' => 'product[attributes][' . $attribute->getId() . ']', 'classes' => array('attribute-' . $attribute->getId()), 'value' => apply_filters('jigoshop\\template\\admin\\product\\attribute\\select\\value', $attribute->getValue(), $attribute), 'options' => Product::getSelectOption($attribute->getOptions()), 'size' => 12)); ?> </div><?php break; case Attribute\Text::TYPE: ?> <div class="panel-body"><?php Forms::text(array('name' => 'product[attributes][' . $attribute->getId() . ']', 'classes' => array('attribute-' . $attribute->getId(), $attribute->isLocal() ? 'local' : ''), 'value' => apply_filters('jigoshop\\template\\admin\\product\\attribute\\text\\value', $attribute->getValue(), $attribute), 'size' => 12)); ?> </div><?php break; } ?> </div> </div> </li>
<h4 class="list-group-item-heading clearfix"> <button type="button" class="remove-variation btn btn-default pull-right" title="<?php _e('Remove', 'jigoshop'); ?> "><span class="glyphicon glyphicon-remove"></span></button> <button type="button" class="show-variation btn btn-default pull-right" title="<?php _e('Expand', 'jigoshop'); ?> "><span class="glyphicon glyphicon-collapse-down"></span></button> <?php foreach ($attributes as $attribute) { /** @var $attribute Attribute */ $value = $variation->getAttribute($attribute->getId()); ?> <?php Forms::select(array('name' => 'product[variation][' . $variation->getId() . '][attribute][' . $attribute->getId() . ']', 'classes' => array('variation-attribute'), 'placeholder' => $attribute->getLabel(), 'value' => $value !== null ? $value->getValue() : '', 'options' => ProductHelper::getSelectOption($attribute->getOptions(), sprintf(__('Any of %s', 'jigoshop'), $attribute->getLabel())), 'size' => 12)); ?> <?php } ?> </h4> <div class="list-group-item-text row clearfix"> <div class="col-md-2"> <?php echo Product::getFeaturedImage($product, \Jigoshop\Core\Options::IMAGE_SMALL); ?> <button class="btn btn-block btn-default set_variation_image"><?php _e('Set image', 'jigoshop'); ?> </button> <button class="btn btn-block btn-danger remove_variation_image<?php
/** * Get additional information about the products of variables. * * @param \Jigoshop\Entity\Product\Variable $product - Product * @param string $type - chose to display sku or stock information * * @return string */ public function getVariableAdditionalInfo($product, $type) { if ($product->getType() == Product\Variable::TYPE && $this->options->get('advanced.products_list.variations_sku_stock')) { $additionalInfo = ''; /** @var \Jigoshop\Entity\Product\Variable\Variation $variation */ /** @var Product\Attribute $attribute */ foreach ($product->getVariations() as $variation) { if ($type == 'sku') { $additionalInfo .= $variation->getProduct()->getSku() . '<br />'; } elseif ($type == 'stock') { $variation_name = array(); $attributes = $product->getVariableAttributes(); foreach ($attributes as $attribute) { $variation_name[] = ProductHelper::getSelectOption($attribute->getOptions())[$variation->getAttribute($attribute->getId())->getValue()]; } $additionalInfo .= join(' - ', $variation_name) . ' (' . $variation->getProduct()->getStock()->getStock() . ')<br />'; } } return $additionalInfo; } else { if ($type == 'sku') { return $product->getSku(); } elseif ($type == 'stock') { return ProductHelper::getStock($product); } } }