Impemented combination creation
This commit is contained in:
@@ -61,6 +61,11 @@ use Thelia\Model\ProductSaleElementsQuery;
|
||||
use Propel\Runtime\ActiveQuery\PropelQuery;
|
||||
use Thelia\Core\Event\ProductDeleteCategoryEvent;
|
||||
use Thelia\Core\Event\ProductAddCategoryEvent;
|
||||
use Thelia\Model\AttributeAvQuery;
|
||||
use Thelia\Model\AttributeCombination;
|
||||
use Thelia\Core\Event\ProductCreateCombinationEvent;
|
||||
use Propel\Runtime\Propel;
|
||||
use Thelia\Model\Map\ProductTableMap;
|
||||
|
||||
class Product extends BaseAction implements EventSubscriberInterface
|
||||
{
|
||||
@@ -331,7 +336,6 @@ class Product extends BaseAction implements EventSubscriberInterface
|
||||
|
||||
->setProductId($event->getProductId())
|
||||
->setFeatureId($event->getFeatureId())
|
||||
|
||||
;
|
||||
}
|
||||
|
||||
@@ -356,6 +360,58 @@ class Product extends BaseAction implements EventSubscriberInterface
|
||||
;
|
||||
}
|
||||
|
||||
public function createProductCombination(ProductCreateCombinationEvent $event) {
|
||||
|
||||
$con = Propel::getWriteConnection(ProductTableMap::DATABASE_NAME);
|
||||
|
||||
$con->beginTransaction();
|
||||
|
||||
try {
|
||||
|
||||
if ($event->getUseDefaultPricing()) {
|
||||
// Get the default pricing
|
||||
$salesElement = ProductSaleElementsQuery::create()->filterByIsDefault(true)->findOne();
|
||||
}
|
||||
else {
|
||||
// We have to create a new ProductSaleElement
|
||||
echo "no default !!!!";
|
||||
exit;
|
||||
}
|
||||
|
||||
if (null == $salesElement)
|
||||
throw new \LogicException("Cannot create or get the product sales element for this new combination.");
|
||||
|
||||
$combinationAttributes = $event->getAttributeAvList();
|
||||
|
||||
if (count($combinationAttributes) > 0) {
|
||||
|
||||
foreach($combinationAttributes as $attributeAvId) {
|
||||
|
||||
$attributeAv = AttributeAvQuery::create()->findPk($attributeAvId);
|
||||
|
||||
if ($attributeAv !== null) {
|
||||
$attributeCombination = new AttributeCombination();
|
||||
|
||||
$attributeCombination
|
||||
->setAttributeAvId($attributeAvId)
|
||||
->setAttribute($attributeAv->getAttribute())
|
||||
->setProductSaleElements($salesElement)
|
||||
->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Store all the stuff !
|
||||
$con->commit();
|
||||
}
|
||||
catch(\Exception $ex) {
|
||||
|
||||
$con->rollback();
|
||||
|
||||
throw $ex;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@@ -374,6 +430,9 @@ class Product extends BaseAction implements EventSubscriberInterface
|
||||
TheliaEvents::PRODUCT_UPDATE_ACCESSORY_POSITION => array("updateAccessoryPosition", 128),
|
||||
TheliaEvents::PRODUCT_UPDATE_CONTENT_POSITION => array("updateContentPosition", 128),
|
||||
|
||||
TheliaEvents::PRODUCT_ADD_COMBINATION => array("createProductCombination", 128),
|
||||
TheliaEvents::PRODUCT_DELETE_COMBINATION => array("deleteProductCombination", 128),
|
||||
|
||||
TheliaEvents::PRODUCT_ADD_ACCESSORY => array("addAccessory", 128),
|
||||
TheliaEvents::PRODUCT_REMOVE_ACCESSORY => array("removeAccessory", 128),
|
||||
|
||||
|
||||
@@ -230,12 +230,19 @@
|
||||
<requirement key="_format">xml|json</requirement>
|
||||
</route>
|
||||
|
||||
|
||||
<route id="admin.product.add-attribute-value-to-combination" path="/admin/product/{productId}/add-attribute-value-to-combination/{attributeAvId}/{combination}.{_format}" methods="GET">
|
||||
<default key="_controller">Thelia\Controller\Admin\ProductController::addAttributeValueToCombinationAction</default>
|
||||
<requirement key="_format">xml|json</requirement>
|
||||
</route>
|
||||
|
||||
<route id="admin.product.combination.add" path="/admin/product/combination/add">
|
||||
<default key="_controller">Thelia\Controller\Admin\ProductController::addCombinationAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.product.combination.delete" path="/admin/product/combination/delete">
|
||||
<default key="_controller">Thelia\Controller\Admin\ProductController::deleteCombinationAction</default>
|
||||
</route>
|
||||
|
||||
|
||||
<!-- Folder routes management -->
|
||||
|
||||
|
||||
@@ -48,11 +48,14 @@ use Thelia\Model\FeatureQuery;
|
||||
use Thelia\Core\Event\FeatureProductDeleteEvent;
|
||||
use Thelia\Model\FeatureTemplateQuery;
|
||||
use Thelia\Core\Event\ProductSetTemplateEvent;
|
||||
use Thelia\Model\Base\ProductSaleElementsQuery;
|
||||
use Thelia\Core\Event\ProductAddCategoryEvent;
|
||||
use Thelia\Core\Event\ProductDeleteCategoryEvent;
|
||||
use Thelia\Model\AttributeQuery;
|
||||
use Thelia\Model\AttributeAvQuery;
|
||||
use Thelia\Model\ProductSaleElementsQuery;
|
||||
use Thelia\Model\AttributeCombination;
|
||||
use Thelia\Model\AttributeAv;
|
||||
use Thelia\Core\Event\ProductCreateCombinationEvent;
|
||||
|
||||
/**
|
||||
* Manages products
|
||||
@@ -699,6 +702,7 @@ class ProductController extends AbstractCrudController
|
||||
}
|
||||
|
||||
public function addAttributeValueToCombinationAction($productId, $attributeAvId, $combination) {
|
||||
|
||||
$result = array();
|
||||
|
||||
// Get attribute for this product
|
||||
@@ -708,6 +712,8 @@ class ProductController extends AbstractCrudController
|
||||
|
||||
$addIt = true;
|
||||
|
||||
$attribute = $attributeAv->getAttribute();
|
||||
|
||||
// Check if this attribute is not already present
|
||||
$combinationArray = explode(',', $combination);
|
||||
|
||||
@@ -717,9 +723,7 @@ class ProductController extends AbstractCrudController
|
||||
|
||||
if ($attrAv !== null) {
|
||||
|
||||
if ($attrAv->getAttributeId() == $attributeAv->getAttributeId()) {
|
||||
|
||||
$attribute = AttributeQuery::create()->joinWithI18n($this->getCurrentEditionLocale())->findPk($attributeAv->getAttributeId());
|
||||
if ($attrAv->getAttributeId() == $attribute->getId()) {
|
||||
|
||||
$result['error'] = $this->getTranslator()->trans(
|
||||
'A value for attribute "%name" is already present in the combination',
|
||||
@@ -729,13 +733,39 @@ class ProductController extends AbstractCrudController
|
||||
$addIt = false;
|
||||
}
|
||||
|
||||
$result[] = array('id' => $attrAv->getId(), 'title' => $attrAv->getTitle());
|
||||
$result[] = array('id' => $attrAv->getId(), 'title' => $attrAv->getAttribute()->getTitle() . " : " . $attrAv->getTitle());
|
||||
}
|
||||
}
|
||||
|
||||
if ($addIt) $result[] = array('id' => $attributeAv->getId(), 'title' => $attributeAv->getTitle());
|
||||
if ($addIt) $result[] = array('id' => $attributeAv->getId(), 'title' => $attribute->getTitle() . " : " . $attributeAv->getTitle());
|
||||
}
|
||||
|
||||
return $this->jsonResponse(json_encode($result));
|
||||
}
|
||||
|
||||
/**
|
||||
* A a new combination to a product
|
||||
*/
|
||||
public function addCombinationAction() {
|
||||
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.products.update")) return $response;
|
||||
|
||||
$event = new ProductCreateCombinationEvent(
|
||||
$this->getExistingObject(),
|
||||
$this->getRequest()->get('use_default_princing', 0),
|
||||
$this->getRequest()->get('combination_attributes', array())
|
||||
);
|
||||
|
||||
try {
|
||||
$this->dispatch(TheliaEvents::PRODUCT_ADD_COMBINATION, $event);
|
||||
}
|
||||
catch (\Exception $ex) {
|
||||
// Any error
|
||||
return $this->errorPage($ex);
|
||||
}
|
||||
echo "done!";
|
||||
exit;
|
||||
$this->redirectToEditionTemplate();
|
||||
}
|
||||
}
|
||||
|
||||
63
core/lib/Thelia/Core/Event/ProductCreateCombinationEvent.php
Normal file
63
core/lib/Thelia/Core/Event/ProductCreateCombinationEvent.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Core\Event;
|
||||
|
||||
use Thelia\Model\Product;
|
||||
class ProductCreateCombinationEvent extends ProductEvent
|
||||
{
|
||||
protected $use_default_pricing;
|
||||
protected $attribute_av_list;
|
||||
|
||||
public function __construct(Product $product, $use_default_pricing, $attribute_av_list)
|
||||
{
|
||||
parent::__construct($product);
|
||||
|
||||
$this->use_default_pricing = $use_default_pricing;
|
||||
$this->attribute_av_list = $attribute_av_list;
|
||||
}
|
||||
|
||||
public function getUseDefaultPricing()
|
||||
{
|
||||
return $this->use_default_pricing;
|
||||
}
|
||||
|
||||
public function setUseDefaultPricing($use_default_pricing)
|
||||
{
|
||||
$this->use_default_pricing = $use_default_pricing;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAttributeAvList()
|
||||
{
|
||||
return $this->attribute_av_list;
|
||||
}
|
||||
|
||||
public function setAttributeAvList($attribute_av_list)
|
||||
{
|
||||
$this->attribute_av_list = $attribute_av_list;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -188,7 +188,10 @@ final class TheliaEvents
|
||||
const PRODUCT_REMOVE_CONTENT = "action.productRemoveContent";
|
||||
const PRODUCT_UPDATE_CONTENT_POSITION = "action.updateProductContentPosition";
|
||||
|
||||
const PRODUCT_SET_TEMPLATE = "action.productSetTemplate";
|
||||
const PRODUCT_ADD_COMBINATION = "action.productAddCombination";
|
||||
const PRODUCT_DELETE_COMBINATION = "action.productDeleteCombination";
|
||||
|
||||
const PRODUCT_SET_TEMPLATE = "action.productSetTemplate";
|
||||
|
||||
const PRODUCT_ADD_ACCESSORY = "action.productAddProductAccessory";
|
||||
const PRODUCT_REMOVE_ACCESSORY = "action.productRemoveProductAccessory";
|
||||
|
||||
@@ -170,17 +170,18 @@ class ProductSaleElements extends BaseLoop
|
||||
$taxedPromoPrice = null;
|
||||
}
|
||||
|
||||
$loopResultRow->set("ID", $PSEValue->getId())
|
||||
->set("QUANTITY", $PSEValue->getQuantity())
|
||||
->set("IS_PROMO", $PSEValue->getPromo() === 1 ? 1 : 0)
|
||||
->set("IS_NEW", $PSEValue->getNewness() === 1 ? 1 : 0)
|
||||
->set("WEIGHT", $PSEValue->getWeight())
|
||||
->set("PRICE", $price)
|
||||
->set("PRICE_TAX", $taxedPrice - $price)
|
||||
->set("TAXED_PRICE", $taxedPrice)
|
||||
->set("PROMO_PRICE", $promoPrice)
|
||||
->set("PROMO_PRICE_TAX", $taxedPromoPrice - $promoPrice)
|
||||
->set("TAXED_PROMO_PRICE", $taxedPromoPrice);
|
||||
$loopResultRow
|
||||
->set("ID" , $PSEValue->getId())
|
||||
->set("QUANTITY" , $PSEValue->getQuantity())
|
||||
->set("IS_PROMO" , $PSEValue->getPromo() === 1 ? 1 : 0)
|
||||
->set("IS_NEW" , $PSEValue->getNewness() === 1 ? 1 : 0)
|
||||
->set("WEIGHT" , $PSEValue->getWeight())
|
||||
->set("PRICE" , $price)
|
||||
->set("PRICE_TAX" , $taxedPrice - $price)
|
||||
->set("TAXED_PRICE" , $taxedPrice)
|
||||
->set("PROMO_PRICE" , $promoPrice)
|
||||
->set("PROMO_PRICE_TAX" , $taxedPromoPrice - $promoPrice)
|
||||
->set("TAXED_PROMO_PRICE" , $taxedPromoPrice);
|
||||
|
||||
$loopResult->addRow($loopResultRow);
|
||||
}
|
||||
|
||||
@@ -98,8 +98,6 @@ class Product extends BaseProduct
|
||||
->filterByDefaultCategory(true)
|
||||
->findOne()
|
||||
;
|
||||
echo "newcat= $defaultCategoryId ";
|
||||
var_dump($productCategory);
|
||||
|
||||
if ($productCategory == null || $productCategory->getCategoryId() != $defaultCategoryId) {
|
||||
exit;
|
||||
|
||||
@@ -12,6 +12,8 @@ A generic modal creation dialog template. Parameters
|
||||
form_action = The form action URL. Form is submitted when OK button is clicked
|
||||
form_enctype = The form encoding
|
||||
form_error_message = The form error message (optional)
|
||||
|
||||
ok_button_id (optionnal) = the id of the OK button
|
||||
*}
|
||||
<div class="modal fade" id="{$dialog_id}" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
|
||||
@@ -33,7 +35,7 @@ A generic modal creation dialog template. Parameters
|
||||
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal" aria-hidden="true"><span class="glyphicon glyphicon-remove"></span> {$dialog_cancel_label|default:{intl l='Cancel'}}</button>
|
||||
<button type="submit" class="btn btn-default btn-primary"><span class="glyphicon glyphicon-check"></span> {$dialog_ok_label|default:{intl l='OK'}}</button>
|
||||
<button {if ! empty($ok_button_id)}id="{$ok_button_id}"{/if} type="submit" class="btn btn-default btn-primary"><span class="glyphicon glyphicon-check"></span> {$dialog_ok_label|default:{intl l='OK'}}</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
@@ -37,6 +37,10 @@
|
||||
{/form_field}
|
||||
{/loop}
|
||||
|
||||
<p class="title title-without-tabs">{intl l='Default pricing'}</p>
|
||||
|
||||
<p>{intl l="The default pricing is used with product that do not have any combinations. It is also used for product with combinations which share the same pricing information"}</p>
|
||||
|
||||
<div class="row">
|
||||
|
||||
{* -- Pricing ------------------------------------------------------- *}
|
||||
@@ -173,81 +177,193 @@
|
||||
|
||||
{* -- Attribute combinations -------------------------------------------- *}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
{module_include location='product_before_combinations'}
|
||||
|
||||
<p class="title title-without-tabs">{intl l='Attribute Combinations'}</p>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="well well-sm">
|
||||
|
||||
{module_include location='product_before_combinations'}
|
||||
<table class="table table-striped table-condensed" id="category_list">
|
||||
<caption>
|
||||
{intl l='Attribute Combinations'}
|
||||
|
||||
{ifloop rel="product-attributes"}
|
||||
<form method="POST" action="{url path='/admin/products/combinations/save'}" {form_enctype form=$form} class="clearfix">
|
||||
<div class="well well-sm">
|
||||
<p class="title title-without-tabs">{intl l='Create a new combination'}</p>
|
||||
{module_include location='product_combinations_list_caption'}
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label">{intl l="Attribute"} : </label>
|
||||
<select required="required" name="attribute_id" id="attribute_id" class="form-control">
|
||||
<option value="">{intl l='Select an attribute...'}</option>
|
||||
{loop name="product-attributes" type="attribute" product=$product_id backend_context="1" lang=$edit_language_id}
|
||||
<option value="{$ID}">{$TITLE}</option>
|
||||
{/loop}
|
||||
</select>
|
||||
<span class="help-block">{intl l='Select an attribute and click (+) to view available values'}</span>
|
||||
</div>
|
||||
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.products.update"}
|
||||
<a class="btn btn-default btn-primary action-btn" title="{intl l='Add a new combination'}" href="#combination_creation_dialog" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-plus-sign"></span>
|
||||
</a>
|
||||
{/loop}
|
||||
</caption>
|
||||
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{intl l='Attributes'}</th>
|
||||
<th class="text-center">{intl l='Quantity'}</th>
|
||||
<th class="text-center">{intl l='Price<br />w/o taxes (%currency)' currency=$currency_symbol}</th>
|
||||
<th class="text-center">{intl l='Price<br />w/ taxes (%currency)' currency=$currency_symbol}</th>
|
||||
<th class="text-center">{intl l='Weight (Kg)'}</th>
|
||||
<th class="text-center">{intl l='Is new'}</th>
|
||||
<th class="text-center">{intl l='On sale'}</th>
|
||||
<th class="text-center">{intl l='Sale price<br />w/o taxes (%currency)' currency=$currency_symbol}</th>
|
||||
<th class="text-center">{intl l='Sale price<br />w/ taxes (%currency)' currency=$currency_symbol}</th>
|
||||
<th class="actions">{intl l='Actions'}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{loop name="product.sales.elements" type="product_sale_elements" product=$product_id currency=$edit_currency_id}
|
||||
<tr>
|
||||
<td>
|
||||
{loop name="product.sales.elements.combinations" type="attribute_combination" product_sale_elements=$ID}
|
||||
{$ATTRIBUTE_TITLE}
|
||||
{/loop}
|
||||
</td>
|
||||
|
||||
<td><input class="form-control text-right" type="text" name="quantity[{$ID}]" value="{format_number number=$QUANTITY}" /></td>
|
||||
<td><input class="form-control text-right" type="text" name="price_wo_taxes[{$ID}]" value="{format_number number=$PRICE_TAX}" /></td>
|
||||
<td><input class="form-control text-right" type="text" name="price_w_taxes[{$ID}]" value="{format_number number=$TAXED_PRICE}" /></td>
|
||||
<td><input class="form-control text-right" type="text" name="weight[{$ID}]" value="{format_number number=$WEIGHT}" /></td>
|
||||
|
||||
<td>
|
||||
<div class="make-switch switch-small" data-on="success" data-off="danger" data-on-label="<i class='glyphicon glyphicon-ok'></i>" data-off-label="<i class='glyphicon glyphicon-remove'></i>">
|
||||
<input class="change-default" type="radio" name="on_sale[{$ID}]" value="{$ID}" {if $IS_PROMO}checked="checked"{/if}/>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<div class="make-switch switch-small" data-on="success" data-off="danger" data-on-label="<i class='glyphicon glyphicon-ok'></i>" data-off-label="<i class='glyphicon glyphicon-remove'></i>">
|
||||
<input class="change-default" type="radio" name="is_new[{$ID}]" value="{$ID}" {if $IS_NEW}checked="checked"{/if}/>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
<td><input class="form-control text-right" type="text" name="sale_price_wo_taxes[{$ID}]" value="{format_number number=$PROMO_PRICE_TAX}" /></td>
|
||||
<td><input class="form-control text-right" type="text" name="sale_price_w_taxes[{$ID}]" value="{format_number number=$TAXED_PROMO_PRICE}" /></td>
|
||||
|
||||
<td class="actions">
|
||||
<a class="btn btn-default btn-xs combination-delete" title="{intl l='Delete this combination'}" href="#combination_delete_dialog" data-id="{$ID}" data-toggle="modal"><i class="glyphicon glyphicon-trash"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
{/loop}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{module_include location='product_after_combinations'}
|
||||
</div>
|
||||
|
||||
{* -- Adding a new combination ------------------------------------------------- *}
|
||||
|
||||
{* Capture the dialog body, to pass it to the generic dialog *}
|
||||
|
||||
{capture "combination_creation_dialog"}
|
||||
|
||||
<input type="hidden" name="product_id" value="{$product_id}" />
|
||||
<input type="hidden" name="current_tab" value="details" />
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label">{intl l="Attribute"} : </label>
|
||||
<select name="attribute_id" id="attribute_id" class="form-control">
|
||||
<option value="">{intl l='Select an attribute...'}</option>
|
||||
{loop name="product-attributes" type="attribute" product=$product_id backend_context="1" lang=$edit_language_id}
|
||||
<option value="{$ID}">{$TITLE}</option>
|
||||
{/loop}
|
||||
</select>
|
||||
<span class="help-block">{intl l='Select an attribute and click (+) to view available values'}</span>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="attribute_value_selector" class="hide">
|
||||
<div class="input-group">
|
||||
{* <label class="control-label">{intl l="Attribute values"} : </label> *}
|
||||
<div id="attribute_value_selector" class="hide">
|
||||
<div class="input-group">
|
||||
{* <label class="control-label">{intl l="Attribute values"} : </label> *}
|
||||
|
||||
<select required="required" name="attribute_value_id" id="attribute_value_id" class="form-control">
|
||||
<option value="">{intl l='Select an attribute value...'}</option>
|
||||
</select>
|
||||
<select rname="attribute_value_id" id="attribute_value_id" class="form-control">
|
||||
<option value="">{intl l='Select an attribute value...'}</option>
|
||||
</select>
|
||||
|
||||
<span class="input-group-btn" id="add_attr_value_button">
|
||||
<button class="btn btn-default btn-primary action-btn add-value-to-combination" type="button"><span class="glyphicon glyphicon-plus-sign"></span></button>
|
||||
</span>
|
||||
</div>
|
||||
<span class="input-group-btn" id="add_attr_value_button">
|
||||
<button class="btn btn-default btn-primary action-btn add-value-to-combination" type="button"><span class="glyphicon glyphicon-plus-sign"></span></button>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<span class="help-block">{intl l='Select a value click (+) to add it to the combination'}</span>
|
||||
</div>
|
||||
<span class="help-block">{intl l='Select a value click (+) to add it to the combination'}</span>
|
||||
</div>
|
||||
|
||||
<div id="attribute_value_selector_empty" class="hide">
|
||||
<div class="alert alert-info">
|
||||
{intl l="No available value for this attribute"}
|
||||
</div>
|
||||
</div>
|
||||
<div id="attribute_value_selector_empty" class="hide">
|
||||
<div class="alert alert-info">
|
||||
{intl l="No available value for this attribute"}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="alert alert-danger hide" id="combination_attributes_error"></div>
|
||||
<div class="form-group">
|
||||
<div class="alert alert-danger hide" id="combination_attributes_error"></div>
|
||||
|
||||
<select multiple="multiple" size="5" name="combination_attributes" id="combination_attributes" class="form-control">
|
||||
</select>
|
||||
<select required="required" multiple="multiple" size="5" name="combination_attributes[]" id="combination_attributes" class="form-control">
|
||||
</select>
|
||||
|
||||
<div class="help-block">
|
||||
{intl l='To remove a value from the combination, select it and click "remove"'}
|
||||
<div class="help-block">
|
||||
{intl l='To remove a value from the combination, select it and click "remove"'}
|
||||
|
||||
<div class="pull-right">
|
||||
<button class="btn btn-info btn-xs remove-value-from-combination" type="button">
|
||||
{intl l="Remove selected value"} <span class="glyphicon glyphicon-minus-sign"></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
<button class="btn btn-info btn-xs remove-value-from-combination" type="button">
|
||||
{intl l="Remove selected values"} <span class="glyphicon glyphicon-minus-sign"></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
{/ifloop}
|
||||
{form_field form=$form field='isnew'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input type="checkbox" id="use_default_princing" name="use_default_princing" value="1">
|
||||
{intl l="Use default princing for this combination (you can change this later)"}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{elseloop rel="product-attributes"}
|
||||
<div class="alert alert-info">
|
||||
{intl l="No attributes are attached to this product."}
|
||||
</div>
|
||||
{/elseloop}
|
||||
{/capture}
|
||||
|
||||
{module_include location='product_after_combinations'}
|
||||
{include
|
||||
file = "includes/generic-create-dialog.html"
|
||||
|
||||
</div> {* com *}
|
||||
</div> {* row *}
|
||||
</div>
|
||||
dialog_id = "combination_creation_dialog"
|
||||
dialog_title = {intl l="Create a new combination"}
|
||||
dialog_body = {$smarty.capture.combination_creation_dialog nofilter}
|
||||
|
||||
dialog_ok_label = {intl l="Create this combination"}
|
||||
|
||||
form_action = {url path='/admin/product/combination/add'}
|
||||
form_enctype = ''
|
||||
form_error_message = ''
|
||||
|
||||
ok_button_id = "combination_creation_dialog_ok"
|
||||
}
|
||||
|
||||
|
||||
{* -- Delete combination confirmation dialog ----------------------------------- *}
|
||||
|
||||
{capture "combination_delete_dialog"}
|
||||
|
||||
<input type="hidden" name="product_id" value="{$product_id}" />
|
||||
<input type="hidden" name="current_tab" value="details" />
|
||||
|
||||
<input type="hidden" name="combination_id" id="combination_delete_id" value="" />
|
||||
|
||||
{module_include location='category_delete_form'}
|
||||
|
||||
{/capture}
|
||||
|
||||
{include
|
||||
file = "includes/generic-confirm-dialog.html"
|
||||
|
||||
dialog_id = "combination_delete_dialog"
|
||||
dialog_title = {intl l="Delete a combunation"}
|
||||
dialog_message = {intl l="Do you really want to delete this combination ?"}
|
||||
|
||||
form_action = {url path='/admin/product/combination/delete'}
|
||||
form_content = {$smarty.capture.combination_delete_dialog nofilter}
|
||||
}
|
||||
|
||||
@@ -229,6 +229,17 @@ $(function() {
|
||||
|
||||
event.preventDefault();
|
||||
});
|
||||
|
||||
// Set proper category ID in combination delete from
|
||||
$('a.combination-delete').click(function(ev) {
|
||||
$('#combination_delete_id').val($(this).data('id'));
|
||||
});
|
||||
|
||||
// In create combination dialog, select all element of conbination list
|
||||
$('#combination_creation_dialog_ok').click(function() {
|
||||
$('#combination_attributes option').prop('selected', 'selected');
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user