From e27b3cfbaee509a2e6edfc740524f846f72c6a79 Mon Sep 17 00:00:00 2001 From: franck Date: Fri, 20 Sep 2013 15:54:50 +0200 Subject: [PATCH] Working catalog branch --- core/lib/Thelia/Action/Product.php | 72 + .../Controller/Admin/ProductController.php | 74 +- core/lib/Thelia/Core/Event/TheliaEvents.php | 24 +- .../Core/Template/Loop/FeatureValue.php | 50 +- .../lib/Thelia/Core/Template/Loop/Product.php | 1 + .../Model/Base/AttributeCombination.php | 103 +- .../Model/Base/AttributeCombinationQuery.php | 33 +- core/lib/Thelia/Model/Base/FeatureProduct.php | 48 +- .../Thelia/Model/Base/FeatureProductQuery.php | 28 +- core/lib/Thelia/Model/Base/OrderProduct.php | 1052 +++++-- .../Thelia/Model/Base/OrderProductQuery.php | 422 ++- core/lib/Thelia/Model/FeatureProduct.php | 60 +- .../Map/AttributeCombinationTableMap.php | 36 +- .../Model/Map/FeatureProductTableMap.php | 30 +- .../Thelia/Model/Map/OrderProductTableMap.php | 112 +- .../Model/Map/ProductSaleElementsTableMap.php | 2 +- core/lib/Thelia/Model/Map/TaxI18nTableMap.php | 2 +- .../Thelia/Model/Map/TaxRuleI18nTableMap.php | 2 +- install/faker.php | 2 +- install/thelia.sql | 70 +- local/config/schema.xml | 2482 +++++++++-------- .../default/ajax/template-attribute-list.html | 2 +- .../default/ajax/template-feature-list.html | 2 +- templates/admin/default/category-edit.html | 4 +- templates/admin/default/feature-edit.html | 8 +- templates/admin/default/folder-edit.html | 4 +- .../standard-description-form-fields.html | 2 +- templates/admin/default/product-edit.html | 377 +-- 28 files changed, 3112 insertions(+), 1992 deletions(-) diff --git a/core/lib/Thelia/Action/Product.php b/core/lib/Thelia/Action/Product.php index 69a07c157..8865f25b2 100644 --- a/core/lib/Thelia/Action/Product.php +++ b/core/lib/Thelia/Action/Product.php @@ -48,6 +48,11 @@ use Thelia\Model\AccessoryQuery; use Thelia\Model\Accessory; use Thelia\Core\Event\ProductAddAccessoryEvent; use Thelia\Core\Event\ProductDeleteAccessoryEvent; +use Thelia\Core\Event\FeatureProductUpdateEvent; +use Thelia\Model\FeatureProduct; +use Thelia\Model\FeatureQuery; +use Thelia\Core\Event\FeatureProductDeleteEvent; +use Thelia\Model\FeatureProductQuery; class Product extends BaseAction implements EventSubscriberInterface { @@ -247,6 +252,70 @@ class Product extends BaseAction implements EventSubscriberInterface } } + public function updateFeatureProductValue(FeatureProductUpdateEvent $event) { + + // If the feature is not free text, it may have one ore more values. + // If the value exists, we do not change it + // If the value does not exists, we create it. + // + // If the feature is free text, it has only a single value. + // Etiher create or update it. + + $featureProductQuery = FeatureProductQuery::create() + ->filterByFeatureId($event->getFeatureId()) + ->filterByProductId($event->getProductId()) + ; + + if ($event->getIsTextValue() !== true) { + $featureProductQuery->filterByFeatureAvId($event->getFeatureValue()); + } + + $featureProduct = $featureProductQuery->findOne(); +echo "
create or update: f=".$event->getFeatureId().", p=".$event->getProductId(); + + if ($featureProduct == null) { +echo " Create !"; + $featureProduct = new FeatureProduct(); + + $featureProduct + ->setDispatcher($this->getDispatcher()) + + ->setProductId($event->getProductId()) + ->setFeatureId($event->getFeatureId()) + + ; + } + else echo " Update !"; + + if ($event->getIsTextValue() == true) { + $featureProduct->setFreeTextValue($event->getFeatureValue()); + } + else { + $featureProduct->setFeatureAvId($event->getFeatureValue()); + } + + $featureProduct->save(); + + $event->setFeatureProduct($featureProduct); + } + + public function deleteFeatureProductValue(FeatureProductDeleteEvent $event) { + + $featureProduct = new FeatureProduct(); + + $featureProduct + ->setDispatcher($this->getDispatcher()) + + ->setProductId($event->getProductId()) + ->setFeatureId($event->getFeatureId()) + + ->delete(); + ; +echo "
Delete p=".$event->getProductId()." f=".$event->getFeatureId(); + + $event->setFeatureProduct($featureProduct); + } + /** * {@inheritDoc} */ @@ -266,6 +335,9 @@ class Product extends BaseAction implements EventSubscriberInterface TheliaEvents::PRODUCT_ADD_ACCESSORY => array("addAccessory", 128), TheliaEvents::PRODUCT_REMOVE_ACCESSORY => array("removeAccessory", 128), + + TheliaEvents::PRODUCT_FEATURE_UPDATE_VALUE => array("updateFeatureProductValue", 128), + TheliaEvents::PRODUCT_FEATURE_DELETE_VALUE => array("deleteFeatureProductValue", 128), ); } } diff --git a/core/lib/Thelia/Controller/Admin/ProductController.php b/core/lib/Thelia/Controller/Admin/ProductController.php index 27c559442..cefed04ff 100644 --- a/core/lib/Thelia/Controller/Admin/ProductController.php +++ b/core/lib/Thelia/Controller/Admin/ProductController.php @@ -43,6 +43,10 @@ use Thelia\Model\AccessoryQuery; use Thelia\Model\CategoryQuery; use Thelia\Core\Event\ProductAddAccessoryEvent; use Thelia\Core\Event\ProductDeleteAccessoryEvent; +use Thelia\Core\Event\FeatureProductUpdateEvent; +use Thelia\Model\FeatureQuery; +use Thelia\Core\Event\FeatureProductDeleteEvent; +use Thelia\Model\FeatureTemplateQuery; /** * Manages products @@ -443,7 +447,7 @@ class ProductController extends AbstractCrudController } /** - * Update accessory position (only for objects whichsupport that) + * Update accessory position */ public function updateAccessoryPositionAction() { @@ -474,4 +478,72 @@ class ProductController extends AbstractCrudController $this->redirectToEditionTemplate(); } + /** + * Update product attributes and features + */ + public function updateAttributesAndFeaturesAction($productId) { + + // et all features for the product's template + $product = ProductQuery::create()->findPk($productId); + + if ($product != null) { + + $featureTemplate = FeatureTemplateQuery::create()->filterByTemplateId($product->getTemplateId())->find(); + + if ($featureTemplate !== null) { + // Get all features for the template attached to this product + $allFeatures = FeatureQuery::create() + ->filterByFeatureTemplate($featureTemplate) + ->find(); + + $updatedFeatures = array(); + + // Update all features values + $featureValues = $this->getRequest()->get('feature_value', array()); +print_r($featureValues); + foreach($featureValues as $featureId => $featureValueList) { + + // Delete all values for this feature. + $event = new FeatureProductDeleteEvent($productId, $featureId); + + $this->dispatch(TheliaEvents::PRODUCT_FEATURE_DELETE_VALUE, $event); + + // Add all selected values + foreach($featureValueList as $featureValue) { + $event = new FeatureProductUpdateEvent($productId, $featureId, $featureValue); + + $this->dispatch(TheliaEvents::PRODUCT_FEATURE_UPDATE_VALUE, $event); + } + + $updatedFeatures[] = $featureId; + } + + // Update then features text values + $featureTextValues = $this->getRequest()->get('feature_text_value', array()); +print_r($featureTextValues); + foreach($featureTextValues as $featureId => $featureValue) { + + // considere empty text as empty feature value (e.g., we will delete it) + if (empty($featureValue)) continue; + + $event = new FeatureProductUpdateEvent($productId, $featureId, $featureValue, true); + + $this->dispatch(TheliaEvents::PRODUCT_FEATURE_UPDATE_VALUE, $event); + + $updatedFeatures[] = $featureId; + } + + // Delete features which don't have any values + foreach($allFeatures as $feature) { + if (! in_array($feature->getId(), $updatedFeatures)) { + $event = new FeatureProductDeleteEvent($productId, $feature->getId()); +echo "delete $productId, ".$feature->getId()." - "; + $this->dispatch(TheliaEvents::PRODUCT_FEATURE_DELETE_VALUE, $event); + } + } + } + } + + $this->redirectToEditionTemplate(); + } } diff --git a/core/lib/Thelia/Core/Event/TheliaEvents.php b/core/lib/Thelia/Core/Event/TheliaEvents.php index 75f5314f0..aee3d81e9 100755 --- a/core/lib/Thelia/Core/Event/TheliaEvents.php +++ b/core/lib/Thelia/Core/Event/TheliaEvents.php @@ -170,8 +170,8 @@ final class TheliaEvents const BEFORE_CREATECATEGORY_ASSOCIATED_CONTENT = "action.before_createCategoryAssociatedContent"; const AFTER_CREATECATEGORY_ASSOCIATED_CONTENT = "action.after_createCategoryAssociatedContent"; - const BEFORE_DELETECATEGORY_ASSOCIATED_CONTENT = "action.before_deleteCategoryAssociatedContenty"; - const AFTER_DELETECATEGORY_ASSOCIATED_CONTENT = "action.after_deleteproduct_accessory"; + const BEFORE_DELETECATEGORY_ASSOCIATED_CONTENT = "action.before_deleteCategoryAssociatedContent"; + const AFTER_DELETECATEGORY_ASSOCIATED_CONTENT = "action.after_deleteCategoryAssociatedContent"; const BEFORE_UPDATECATEGORY_ASSOCIATED_CONTENT = "action.before_updateCategoryAssociatedContent"; const AFTER_UPDATECATEGORY_ASSOCIATED_CONTENT = "action.after_updateCategoryAssociatedContent"; @@ -191,6 +191,9 @@ final class TheliaEvents const PRODUCT_REMOVE_ACCESSORY = "action.productRemoveAccessory"; const PRODUCT_UPDATE_ACCESSORY_POSITION = "action.updateProductPosition"; + const PRODUCT_FEATURE_UPDATE_VALUE = "action.after_updateProductFeatureValue"; + const PRODUCT_FEATURE_DELETE_VALUE = "action.after_deleteProductFeatureValue"; + const BEFORE_CREATEPRODUCT = "action.before_createproduct"; const AFTER_CREATEPRODUCT = "action.after_createproduct"; @@ -211,17 +214,28 @@ final class TheliaEvents const BEFORE_UPDATEACCESSORY = "action.before_updateAccessory"; const AFTER_UPDATEACCESSORY = "action.after_updateAccessory"; - // -- Product Associated Content -------------------------------------------------- + // -- Product Associated Content ------------------------------------------- const BEFORE_CREATEPRODUCT_ASSOCIATED_CONTENT = "action.before_createProductAssociatedContent"; const AFTER_CREATEPRODUCT_ASSOCIATED_CONTENT = "action.after_createProductAssociatedContent"; - const BEFORE_DELETEPRODUCT_ASSOCIATED_CONTENT = "action.before_deleteProductAssociatedContenty"; - const AFTER_DELETEPRODUCT_ASSOCIATED_CONTENT = "action.after_deleteproduct_accessory"; + const BEFORE_DELETEPRODUCT_ASSOCIATED_CONTENT = "action.before_deleteProductAssociatedContent"; + const AFTER_DELETEPRODUCT_ASSOCIATED_CONTENT = "action.after_deleteProductAssociatedContent"; const BEFORE_UPDATEPRODUCT_ASSOCIATED_CONTENT = "action.before_updateProductAssociatedContent"; const AFTER_UPDATEPRODUCT_ASSOCIATED_CONTENT = "action.after_updateProductAssociatedContent"; + // -- Feature product ------------------------------------------------------ + + const BEFORE_CREATEFEATURE_PRODUCT = "action.before_createFeatureProduct"; + const AFTER_CREATEFEATURE_PRODUCT = "action.after_createFeatureProduct"; + + const BEFORE_DELETEFEATURE_PRODUCT = "action.before_deleteFeatureProduct"; + const AFTER_DELETEFEATURE_PRODUCT = "action.after_deleteFeatureProduct"; + + const BEFORE_UPDATEFEATURE_PRODUCT = "action.before_updateFeatureProduct"; + const AFTER_UPDATEFEATURE_PRODUCT = "action.after_updateFeatureProduct"; + /** * sent when a new existing cat id duplicated. This append when current customer is different from current cart */ diff --git a/core/lib/Thelia/Core/Template/Loop/FeatureValue.php b/core/lib/Thelia/Core/Template/Loop/FeatureValue.php index 30a8dcf27..eaa81153b 100755 --- a/core/lib/Thelia/Core/Template/Loop/FeatureValue.php +++ b/core/lib/Thelia/Core/Template/Loop/FeatureValue.php @@ -59,7 +59,7 @@ class FeatureValue extends BaseI18nLoop Argument::createIntTypeArgument('product', null, true), Argument::createIntListTypeArgument('feature_availability'), Argument::createBooleanTypeArgument('exclude_feature_availability', 0), - Argument::createBooleanTypeArgument('exclude_personal_values', 0), + Argument::createBooleanTypeArgument('exclude_free_text', 0), new Argument( 'order', new TypeCollection( @@ -79,14 +79,14 @@ class FeatureValue extends BaseI18nLoop { $search = FeatureProductQuery::create(); - /* manage featureAv translations */ - $locale = $this->configureI18nProcessing( - $search, - array('TITLE', 'CHAPO', 'DESCRIPTION', 'POSTSCRIPTUM'), - FeatureAvTableMap::TABLE_NAME, - 'FEATURE_AV_ID', - true - ); + // manage featureAv translations + $locale = $this->configureI18nProcessing( + $search, + array('TITLE', 'CHAPO', 'DESCRIPTION', 'POSTSCRIPTUM'), + FeatureAvTableMap::TABLE_NAME, + 'FEATURE_AV_ID', + true + ); $feature = $this->getFeature(); @@ -103,13 +103,9 @@ class FeatureValue extends BaseI18nLoop } $excludeFeatureAvailability = $this->getExclude_feature_availability(); - if ($excludeFeatureAvailability == true) { - $search->filterByFeatureAvId(null, Criteria::NULL); - } - $excludeDefaultValues = $this->getExclude_personal_values(); - if ($excludeDefaultValues == true) { - $search->filterByByDefault(null, Criteria::NULL); + if ($excludeFeatureAvailability == true) { + $search->filterByFeatureAvId(null, Criteria::ISNULL); } $orders = $this->getOrder(); @@ -137,16 +133,24 @@ class FeatureValue extends BaseI18nLoop foreach ($featureValues as $featureValue) { $loopResultRow = new LoopResultRow($loopResult, $featureValue, $this->versionable, $this->timestampable, $this->countable); - $loopResultRow->set("ID", $featureValue->getId()); $loopResultRow - ->set("LOCALE",$locale) - ->set("PERSONAL_VALUE", $featureValue->getByDefault()) - ->set("TITLE",$featureValue->getVirtualColumn(FeatureAvTableMap::TABLE_NAME . '_i18n_TITLE')) - ->set("CHAPO", $featureValue->getVirtualColumn(FeatureAvTableMap::TABLE_NAME . '_i18n_CHAPO')) - ->set("DESCRIPTION", $featureValue->getVirtualColumn(FeatureAvTableMap::TABLE_NAME . '_i18n_DESCRIPTION')) - ->set("POSTSCRIPTUM", $featureValue->getVirtualColumn(FeatureAvTableMap::TABLE_NAME . '_i18n_POSTSCRIPTUM')) - ->set("POSITION", $featureValue->getPosition()); + ->set("ID" , $featureValue->getId()) + ->set("PRODUCT" , $featureValue->getProductId()) + ->set("FEATURE_AV_ID" , $featureValue->getFeatureAvId()) + ->set("FREE_TEXT_VALUE" , $featureValue->getFreeTextValue()) + + ->set("IS_FREE_TEXT" , is_null($featureValue->getFeatureAvId()) ? 1 : 0) + ->set("IS_FEATURE_AV" , is_null($featureValue->getFeatureAvId()) ? 0 : 1) + + ->set("LOCALE" , $locale) + ->set("TITLE" , $featureValue->getVirtualColumn(FeatureAvTableMap::TABLE_NAME . '_i18n_TITLE')) + ->set("CHAPO" , $featureValue->getVirtualColumn(FeatureAvTableMap::TABLE_NAME . '_i18n_CHAPO')) + ->set("DESCRIPTION" , $featureValue->getVirtualColumn(FeatureAvTableMap::TABLE_NAME . '_i18n_DESCRIPTION')) + ->set("POSTSCRIPTUM" , $featureValue->getVirtualColumn(FeatureAvTableMap::TABLE_NAME . '_i18n_POSTSCRIPTUM')) + + ->set("POSITION" , $featureValue->getPosition()) + ; $loopResult->addRow($loopResultRow); } diff --git a/core/lib/Thelia/Core/Template/Loop/Product.php b/core/lib/Thelia/Core/Template/Loop/Product.php index 9deade5cc..7c812d81f 100755 --- a/core/lib/Thelia/Core/Template/Loop/Product.php +++ b/core/lib/Thelia/Core/Template/Loop/Product.php @@ -650,6 +650,7 @@ class Product extends BaseI18nLoop ->set("IS_NEW" , $product->getVirtualColumn('main_product_is_new')) ->set("POSITION" , $product->getPosition()) ->set("VISIBLE" , $product->getVisible() ? "1" : "0") + ->set("TEMPLATE" , $product->getTemplateId()) ->set("HAS_PREVIOUS" , $previous != null ? 1 : 0) ->set("HAS_NEXT" , $next != null ? 1 : 0) ->set("PREVIOUS" , $previous != null ? $previous->getId() : -1) diff --git a/core/lib/Thelia/Model/Base/AttributeCombination.php b/core/lib/Thelia/Model/Base/AttributeCombination.php index ef840a5a1..14868edf7 100644 --- a/core/lib/Thelia/Model/Base/AttributeCombination.php +++ b/core/lib/Thelia/Model/Base/AttributeCombination.php @@ -78,6 +78,13 @@ abstract class AttributeCombination implements ActiveRecordInterface */ protected $product_sale_elements_id; + /** + * The value for the is_default field. + * Note: this column has a database default value of: false + * @var boolean + */ + protected $is_default; + /** * The value for the created_at field. * @var string @@ -113,11 +120,24 @@ abstract class AttributeCombination implements ActiveRecordInterface */ protected $alreadyInSave = false; + /** + * Applies default values to this object. + * This method should be called from the object's constructor (or + * equivalent initialization method). + * @see __construct() + */ + public function applyDefaultValues() + { + $this->is_default = false; + } + /** * Initializes internal state of Thelia\Model\Base\AttributeCombination object. + * @see applyDefaults() */ public function __construct() { + $this->applyDefaultValues(); } /** @@ -400,6 +420,17 @@ abstract class AttributeCombination implements ActiveRecordInterface return $this->product_sale_elements_id; } + /** + * Get the [is_default] column value. + * + * @return boolean + */ + public function getIsDefault() + { + + return $this->is_default; + } + /** * Get the [optionally formatted] temporal [created_at] column value. * @@ -515,6 +546,35 @@ abstract class AttributeCombination implements ActiveRecordInterface return $this; } // setProductSaleElementsId() + /** + * Sets the value of the [is_default] column. + * Non-boolean arguments are converted using the following rules: + * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true + * * 0, '0', 'false', 'off', and 'no' are converted to boolean false + * Check on string values is case insensitive (so 'FaLsE' is seen as 'false'). + * + * @param boolean|integer|string $v The new value + * @return \Thelia\Model\AttributeCombination The current object (for fluent API support) + */ + public function setIsDefault($v) + { + if ($v !== null) { + if (is_string($v)) { + $v = in_array(strtolower($v), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true; + } else { + $v = (boolean) $v; + } + } + + if ($this->is_default !== $v) { + $this->is_default = $v; + $this->modifiedColumns[] = AttributeCombinationTableMap::IS_DEFAULT; + } + + + return $this; + } // setIsDefault() + /** * Sets the value of [created_at] column to a normalized version of the date/time value specified. * @@ -567,6 +627,10 @@ abstract class AttributeCombination implements ActiveRecordInterface */ public function hasOnlyDefaultValues() { + if ($this->is_default !== false) { + return false; + } + // otherwise, everything was equal, so return TRUE return true; } // hasOnlyDefaultValues() @@ -603,13 +667,16 @@ abstract class AttributeCombination implements ActiveRecordInterface $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : AttributeCombinationTableMap::translateFieldName('ProductSaleElementsId', TableMap::TYPE_PHPNAME, $indexType)]; $this->product_sale_elements_id = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : AttributeCombinationTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : AttributeCombinationTableMap::translateFieldName('IsDefault', TableMap::TYPE_PHPNAME, $indexType)]; + $this->is_default = (null !== $col) ? (boolean) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : AttributeCombinationTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } $this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : AttributeCombinationTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : AttributeCombinationTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } @@ -622,7 +689,7 @@ abstract class AttributeCombination implements ActiveRecordInterface $this->ensureConsistency(); } - return $startcol + 5; // 5 = AttributeCombinationTableMap::NUM_HYDRATE_COLUMNS. + return $startcol + 6; // 6 = AttributeCombinationTableMap::NUM_HYDRATE_COLUMNS. } catch (Exception $e) { throw new PropelException("Error populating \Thelia\Model\AttributeCombination object", 0, $e); @@ -885,6 +952,9 @@ abstract class AttributeCombination implements ActiveRecordInterface if ($this->isColumnModified(AttributeCombinationTableMap::PRODUCT_SALE_ELEMENTS_ID)) { $modifiedColumns[':p' . $index++] = 'PRODUCT_SALE_ELEMENTS_ID'; } + if ($this->isColumnModified(AttributeCombinationTableMap::IS_DEFAULT)) { + $modifiedColumns[':p' . $index++] = 'IS_DEFAULT'; + } if ($this->isColumnModified(AttributeCombinationTableMap::CREATED_AT)) { $modifiedColumns[':p' . $index++] = 'CREATED_AT'; } @@ -911,6 +981,9 @@ abstract class AttributeCombination implements ActiveRecordInterface case 'PRODUCT_SALE_ELEMENTS_ID': $stmt->bindValue($identifier, $this->product_sale_elements_id, PDO::PARAM_INT); break; + case 'IS_DEFAULT': + $stmt->bindValue($identifier, (int) $this->is_default, PDO::PARAM_INT); + break; case 'CREATED_AT': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; @@ -982,9 +1055,12 @@ abstract class AttributeCombination implements ActiveRecordInterface return $this->getProductSaleElementsId(); break; case 3: - return $this->getCreatedAt(); + return $this->getIsDefault(); break; case 4: + return $this->getCreatedAt(); + break; + case 5: return $this->getUpdatedAt(); break; default: @@ -1019,8 +1095,9 @@ abstract class AttributeCombination implements ActiveRecordInterface $keys[0] => $this->getAttributeId(), $keys[1] => $this->getAttributeAvId(), $keys[2] => $this->getProductSaleElementsId(), - $keys[3] => $this->getCreatedAt(), - $keys[4] => $this->getUpdatedAt(), + $keys[3] => $this->getIsDefault(), + $keys[4] => $this->getCreatedAt(), + $keys[5] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; foreach($virtualColumns as $key => $virtualColumn) @@ -1082,9 +1159,12 @@ abstract class AttributeCombination implements ActiveRecordInterface $this->setProductSaleElementsId($value); break; case 3: - $this->setCreatedAt($value); + $this->setIsDefault($value); break; case 4: + $this->setCreatedAt($value); + break; + case 5: $this->setUpdatedAt($value); break; } // switch() @@ -1114,8 +1194,9 @@ abstract class AttributeCombination implements ActiveRecordInterface if (array_key_exists($keys[0], $arr)) $this->setAttributeId($arr[$keys[0]]); if (array_key_exists($keys[1], $arr)) $this->setAttributeAvId($arr[$keys[1]]); if (array_key_exists($keys[2], $arr)) $this->setProductSaleElementsId($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setCreatedAt($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setUpdatedAt($arr[$keys[4]]); + if (array_key_exists($keys[3], $arr)) $this->setIsDefault($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setCreatedAt($arr[$keys[4]]); + if (array_key_exists($keys[5], $arr)) $this->setUpdatedAt($arr[$keys[5]]); } /** @@ -1130,6 +1211,7 @@ abstract class AttributeCombination implements ActiveRecordInterface if ($this->isColumnModified(AttributeCombinationTableMap::ATTRIBUTE_ID)) $criteria->add(AttributeCombinationTableMap::ATTRIBUTE_ID, $this->attribute_id); if ($this->isColumnModified(AttributeCombinationTableMap::ATTRIBUTE_AV_ID)) $criteria->add(AttributeCombinationTableMap::ATTRIBUTE_AV_ID, $this->attribute_av_id); if ($this->isColumnModified(AttributeCombinationTableMap::PRODUCT_SALE_ELEMENTS_ID)) $criteria->add(AttributeCombinationTableMap::PRODUCT_SALE_ELEMENTS_ID, $this->product_sale_elements_id); + if ($this->isColumnModified(AttributeCombinationTableMap::IS_DEFAULT)) $criteria->add(AttributeCombinationTableMap::IS_DEFAULT, $this->is_default); if ($this->isColumnModified(AttributeCombinationTableMap::CREATED_AT)) $criteria->add(AttributeCombinationTableMap::CREATED_AT, $this->created_at); if ($this->isColumnModified(AttributeCombinationTableMap::UPDATED_AT)) $criteria->add(AttributeCombinationTableMap::UPDATED_AT, $this->updated_at); @@ -1208,6 +1290,7 @@ abstract class AttributeCombination implements ActiveRecordInterface $copyObj->setAttributeId($this->getAttributeId()); $copyObj->setAttributeAvId($this->getAttributeAvId()); $copyObj->setProductSaleElementsId($this->getProductSaleElementsId()); + $copyObj->setIsDefault($this->getIsDefault()); $copyObj->setCreatedAt($this->getCreatedAt()); $copyObj->setUpdatedAt($this->getUpdatedAt()); if ($makeNew) { @@ -1398,10 +1481,12 @@ abstract class AttributeCombination implements ActiveRecordInterface $this->attribute_id = null; $this->attribute_av_id = null; $this->product_sale_elements_id = null; + $this->is_default = null; $this->created_at = null; $this->updated_at = null; $this->alreadyInSave = false; $this->clearAllReferences(); + $this->applyDefaultValues(); $this->resetModified(); $this->setNew(true); $this->setDeleted(false); diff --git a/core/lib/Thelia/Model/Base/AttributeCombinationQuery.php b/core/lib/Thelia/Model/Base/AttributeCombinationQuery.php index 291ff7725..e0f4ee0ea 100644 --- a/core/lib/Thelia/Model/Base/AttributeCombinationQuery.php +++ b/core/lib/Thelia/Model/Base/AttributeCombinationQuery.php @@ -24,12 +24,14 @@ use Thelia\Model\Map\AttributeCombinationTableMap; * @method ChildAttributeCombinationQuery orderByAttributeId($order = Criteria::ASC) Order by the attribute_id column * @method ChildAttributeCombinationQuery orderByAttributeAvId($order = Criteria::ASC) Order by the attribute_av_id column * @method ChildAttributeCombinationQuery orderByProductSaleElementsId($order = Criteria::ASC) Order by the product_sale_elements_id column + * @method ChildAttributeCombinationQuery orderByIsDefault($order = Criteria::ASC) Order by the is_default column * @method ChildAttributeCombinationQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column * @method ChildAttributeCombinationQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column * * @method ChildAttributeCombinationQuery groupByAttributeId() Group by the attribute_id column * @method ChildAttributeCombinationQuery groupByAttributeAvId() Group by the attribute_av_id column * @method ChildAttributeCombinationQuery groupByProductSaleElementsId() Group by the product_sale_elements_id column + * @method ChildAttributeCombinationQuery groupByIsDefault() Group by the is_default column * @method ChildAttributeCombinationQuery groupByCreatedAt() Group by the created_at column * @method ChildAttributeCombinationQuery groupByUpdatedAt() Group by the updated_at column * @@ -55,12 +57,14 @@ use Thelia\Model\Map\AttributeCombinationTableMap; * @method ChildAttributeCombination findOneByAttributeId(int $attribute_id) Return the first ChildAttributeCombination filtered by the attribute_id column * @method ChildAttributeCombination findOneByAttributeAvId(int $attribute_av_id) Return the first ChildAttributeCombination filtered by the attribute_av_id column * @method ChildAttributeCombination findOneByProductSaleElementsId(int $product_sale_elements_id) Return the first ChildAttributeCombination filtered by the product_sale_elements_id column + * @method ChildAttributeCombination findOneByIsDefault(boolean $is_default) Return the first ChildAttributeCombination filtered by the is_default column * @method ChildAttributeCombination findOneByCreatedAt(string $created_at) Return the first ChildAttributeCombination filtered by the created_at column * @method ChildAttributeCombination findOneByUpdatedAt(string $updated_at) Return the first ChildAttributeCombination filtered by the updated_at column * * @method array findByAttributeId(int $attribute_id) Return ChildAttributeCombination objects filtered by the attribute_id column * @method array findByAttributeAvId(int $attribute_av_id) Return ChildAttributeCombination objects filtered by the attribute_av_id column * @method array findByProductSaleElementsId(int $product_sale_elements_id) Return ChildAttributeCombination objects filtered by the product_sale_elements_id column + * @method array findByIsDefault(boolean $is_default) Return ChildAttributeCombination objects filtered by the is_default column * @method array findByCreatedAt(string $created_at) Return ChildAttributeCombination objects filtered by the created_at column * @method array findByUpdatedAt(string $updated_at) Return ChildAttributeCombination objects filtered by the updated_at column * @@ -151,7 +155,7 @@ abstract class AttributeCombinationQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ATTRIBUTE_ID, ATTRIBUTE_AV_ID, PRODUCT_SALE_ELEMENTS_ID, CREATED_AT, UPDATED_AT FROM attribute_combination WHERE ATTRIBUTE_ID = :p0 AND ATTRIBUTE_AV_ID = :p1 AND PRODUCT_SALE_ELEMENTS_ID = :p2'; + $sql = 'SELECT ATTRIBUTE_ID, ATTRIBUTE_AV_ID, PRODUCT_SALE_ELEMENTS_ID, IS_DEFAULT, CREATED_AT, UPDATED_AT FROM attribute_combination WHERE ATTRIBUTE_ID = :p0 AND ATTRIBUTE_AV_ID = :p1 AND PRODUCT_SALE_ELEMENTS_ID = :p2'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); @@ -385,6 +389,33 @@ abstract class AttributeCombinationQuery extends ModelCriteria return $this->addUsingAlias(AttributeCombinationTableMap::PRODUCT_SALE_ELEMENTS_ID, $productSaleElementsId, $comparison); } + /** + * Filter the query on the is_default column + * + * Example usage: + * + * $query->filterByIsDefault(true); // WHERE is_default = true + * $query->filterByIsDefault('yes'); // WHERE is_default = true + * + * + * @param boolean|string $isDefault The value to use as filter. + * Non-boolean arguments are converted using the following rules: + * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true + * * 0, '0', 'false', 'off', and 'no' are converted to boolean false + * Check on string values is case insensitive (so 'FaLsE' is seen as 'false'). + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildAttributeCombinationQuery The current query, for fluid interface + */ + public function filterByIsDefault($isDefault = null, $comparison = null) + { + if (is_string($isDefault)) { + $is_default = in_array(strtolower($isDefault), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true; + } + + return $this->addUsingAlias(AttributeCombinationTableMap::IS_DEFAULT, $isDefault, $comparison); + } + /** * Filter the query on the created_at column * diff --git a/core/lib/Thelia/Model/Base/FeatureProduct.php b/core/lib/Thelia/Model/Base/FeatureProduct.php index 4af200d51..039967cee 100644 --- a/core/lib/Thelia/Model/Base/FeatureProduct.php +++ b/core/lib/Thelia/Model/Base/FeatureProduct.php @@ -85,10 +85,10 @@ abstract class FeatureProduct implements ActiveRecordInterface protected $feature_av_id; /** - * The value for the by_default field. + * The value for the free_text_value field. * @var string */ - protected $by_default; + protected $free_text_value; /** * The value for the position field. @@ -430,14 +430,14 @@ abstract class FeatureProduct implements ActiveRecordInterface } /** - * Get the [by_default] column value. + * Get the [free_text_value] column value. * * @return string */ - public function getByDefault() + public function getFreeTextValue() { - return $this->by_default; + return $this->free_text_value; } /** @@ -588,25 +588,25 @@ abstract class FeatureProduct implements ActiveRecordInterface } // setFeatureAvId() /** - * Set the value of [by_default] column. + * Set the value of [free_text_value] column. * * @param string $v new value * @return \Thelia\Model\FeatureProduct The current object (for fluent API support) */ - public function setByDefault($v) + public function setFreeTextValue($v) { if ($v !== null) { $v = (string) $v; } - if ($this->by_default !== $v) { - $this->by_default = $v; - $this->modifiedColumns[] = FeatureProductTableMap::BY_DEFAULT; + if ($this->free_text_value !== $v) { + $this->free_text_value = $v; + $this->modifiedColumns[] = FeatureProductTableMap::FREE_TEXT_VALUE; } return $this; - } // setByDefault() + } // setFreeTextValue() /** * Set the value of [position] column. @@ -720,8 +720,8 @@ abstract class FeatureProduct implements ActiveRecordInterface $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : FeatureProductTableMap::translateFieldName('FeatureAvId', TableMap::TYPE_PHPNAME, $indexType)]; $this->feature_av_id = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : FeatureProductTableMap::translateFieldName('ByDefault', TableMap::TYPE_PHPNAME, $indexType)]; - $this->by_default = (null !== $col) ? (string) $col : null; + $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : FeatureProductTableMap::translateFieldName('FreeTextValue', TableMap::TYPE_PHPNAME, $indexType)]; + $this->free_text_value = (null !== $col) ? (string) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : FeatureProductTableMap::translateFieldName('Position', TableMap::TYPE_PHPNAME, $indexType)]; $this->position = (null !== $col) ? (int) $col : null; @@ -1015,8 +1015,8 @@ abstract class FeatureProduct implements ActiveRecordInterface if ($this->isColumnModified(FeatureProductTableMap::FEATURE_AV_ID)) { $modifiedColumns[':p' . $index++] = 'FEATURE_AV_ID'; } - if ($this->isColumnModified(FeatureProductTableMap::BY_DEFAULT)) { - $modifiedColumns[':p' . $index++] = 'BY_DEFAULT'; + if ($this->isColumnModified(FeatureProductTableMap::FREE_TEXT_VALUE)) { + $modifiedColumns[':p' . $index++] = 'FREE_TEXT_VALUE'; } if ($this->isColumnModified(FeatureProductTableMap::POSITION)) { $modifiedColumns[':p' . $index++] = 'POSITION'; @@ -1050,8 +1050,8 @@ abstract class FeatureProduct implements ActiveRecordInterface case 'FEATURE_AV_ID': $stmt->bindValue($identifier, $this->feature_av_id, PDO::PARAM_INT); break; - case 'BY_DEFAULT': - $stmt->bindValue($identifier, $this->by_default, PDO::PARAM_STR); + case 'FREE_TEXT_VALUE': + $stmt->bindValue($identifier, $this->free_text_value, PDO::PARAM_STR); break; case 'POSITION': $stmt->bindValue($identifier, $this->position, PDO::PARAM_INT); @@ -1137,7 +1137,7 @@ abstract class FeatureProduct implements ActiveRecordInterface return $this->getFeatureAvId(); break; case 4: - return $this->getByDefault(); + return $this->getFreeTextValue(); break; case 5: return $this->getPosition(); @@ -1181,7 +1181,7 @@ abstract class FeatureProduct implements ActiveRecordInterface $keys[1] => $this->getProductId(), $keys[2] => $this->getFeatureId(), $keys[3] => $this->getFeatureAvId(), - $keys[4] => $this->getByDefault(), + $keys[4] => $this->getFreeTextValue(), $keys[5] => $this->getPosition(), $keys[6] => $this->getCreatedAt(), $keys[7] => $this->getUpdatedAt(), @@ -1249,7 +1249,7 @@ abstract class FeatureProduct implements ActiveRecordInterface $this->setFeatureAvId($value); break; case 4: - $this->setByDefault($value); + $this->setFreeTextValue($value); break; case 5: $this->setPosition($value); @@ -1288,7 +1288,7 @@ abstract class FeatureProduct implements ActiveRecordInterface if (array_key_exists($keys[1], $arr)) $this->setProductId($arr[$keys[1]]); if (array_key_exists($keys[2], $arr)) $this->setFeatureId($arr[$keys[2]]); if (array_key_exists($keys[3], $arr)) $this->setFeatureAvId($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setByDefault($arr[$keys[4]]); + if (array_key_exists($keys[4], $arr)) $this->setFreeTextValue($arr[$keys[4]]); if (array_key_exists($keys[5], $arr)) $this->setPosition($arr[$keys[5]]); if (array_key_exists($keys[6], $arr)) $this->setCreatedAt($arr[$keys[6]]); if (array_key_exists($keys[7], $arr)) $this->setUpdatedAt($arr[$keys[7]]); @@ -1307,7 +1307,7 @@ abstract class FeatureProduct implements ActiveRecordInterface if ($this->isColumnModified(FeatureProductTableMap::PRODUCT_ID)) $criteria->add(FeatureProductTableMap::PRODUCT_ID, $this->product_id); if ($this->isColumnModified(FeatureProductTableMap::FEATURE_ID)) $criteria->add(FeatureProductTableMap::FEATURE_ID, $this->feature_id); if ($this->isColumnModified(FeatureProductTableMap::FEATURE_AV_ID)) $criteria->add(FeatureProductTableMap::FEATURE_AV_ID, $this->feature_av_id); - if ($this->isColumnModified(FeatureProductTableMap::BY_DEFAULT)) $criteria->add(FeatureProductTableMap::BY_DEFAULT, $this->by_default); + if ($this->isColumnModified(FeatureProductTableMap::FREE_TEXT_VALUE)) $criteria->add(FeatureProductTableMap::FREE_TEXT_VALUE, $this->free_text_value); if ($this->isColumnModified(FeatureProductTableMap::POSITION)) $criteria->add(FeatureProductTableMap::POSITION, $this->position); if ($this->isColumnModified(FeatureProductTableMap::CREATED_AT)) $criteria->add(FeatureProductTableMap::CREATED_AT, $this->created_at); if ($this->isColumnModified(FeatureProductTableMap::UPDATED_AT)) $criteria->add(FeatureProductTableMap::UPDATED_AT, $this->updated_at); @@ -1377,7 +1377,7 @@ abstract class FeatureProduct implements ActiveRecordInterface $copyObj->setProductId($this->getProductId()); $copyObj->setFeatureId($this->getFeatureId()); $copyObj->setFeatureAvId($this->getFeatureAvId()); - $copyObj->setByDefault($this->getByDefault()); + $copyObj->setFreeTextValue($this->getFreeTextValue()); $copyObj->setPosition($this->getPosition()); $copyObj->setCreatedAt($this->getCreatedAt()); $copyObj->setUpdatedAt($this->getUpdatedAt()); @@ -1571,7 +1571,7 @@ abstract class FeatureProduct implements ActiveRecordInterface $this->product_id = null; $this->feature_id = null; $this->feature_av_id = null; - $this->by_default = null; + $this->free_text_value = null; $this->position = null; $this->created_at = null; $this->updated_at = null; diff --git a/core/lib/Thelia/Model/Base/FeatureProductQuery.php b/core/lib/Thelia/Model/Base/FeatureProductQuery.php index c6a8f2a73..eb2ee7ec1 100644 --- a/core/lib/Thelia/Model/Base/FeatureProductQuery.php +++ b/core/lib/Thelia/Model/Base/FeatureProductQuery.php @@ -25,7 +25,7 @@ use Thelia\Model\Map\FeatureProductTableMap; * @method ChildFeatureProductQuery orderByProductId($order = Criteria::ASC) Order by the product_id column * @method ChildFeatureProductQuery orderByFeatureId($order = Criteria::ASC) Order by the feature_id column * @method ChildFeatureProductQuery orderByFeatureAvId($order = Criteria::ASC) Order by the feature_av_id column - * @method ChildFeatureProductQuery orderByByDefault($order = Criteria::ASC) Order by the by_default column + * @method ChildFeatureProductQuery orderByFreeTextValue($order = Criteria::ASC) Order by the free_text_value column * @method ChildFeatureProductQuery orderByPosition($order = Criteria::ASC) Order by the position column * @method ChildFeatureProductQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column * @method ChildFeatureProductQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column @@ -34,7 +34,7 @@ use Thelia\Model\Map\FeatureProductTableMap; * @method ChildFeatureProductQuery groupByProductId() Group by the product_id column * @method ChildFeatureProductQuery groupByFeatureId() Group by the feature_id column * @method ChildFeatureProductQuery groupByFeatureAvId() Group by the feature_av_id column - * @method ChildFeatureProductQuery groupByByDefault() Group by the by_default column + * @method ChildFeatureProductQuery groupByFreeTextValue() Group by the free_text_value column * @method ChildFeatureProductQuery groupByPosition() Group by the position column * @method ChildFeatureProductQuery groupByCreatedAt() Group by the created_at column * @method ChildFeatureProductQuery groupByUpdatedAt() Group by the updated_at column @@ -62,7 +62,7 @@ use Thelia\Model\Map\FeatureProductTableMap; * @method ChildFeatureProduct findOneByProductId(int $product_id) Return the first ChildFeatureProduct filtered by the product_id column * @method ChildFeatureProduct findOneByFeatureId(int $feature_id) Return the first ChildFeatureProduct filtered by the feature_id column * @method ChildFeatureProduct findOneByFeatureAvId(int $feature_av_id) Return the first ChildFeatureProduct filtered by the feature_av_id column - * @method ChildFeatureProduct findOneByByDefault(string $by_default) Return the first ChildFeatureProduct filtered by the by_default column + * @method ChildFeatureProduct findOneByFreeTextValue(string $free_text_value) Return the first ChildFeatureProduct filtered by the free_text_value column * @method ChildFeatureProduct findOneByPosition(int $position) Return the first ChildFeatureProduct filtered by the position column * @method ChildFeatureProduct findOneByCreatedAt(string $created_at) Return the first ChildFeatureProduct filtered by the created_at column * @method ChildFeatureProduct findOneByUpdatedAt(string $updated_at) Return the first ChildFeatureProduct filtered by the updated_at column @@ -71,7 +71,7 @@ use Thelia\Model\Map\FeatureProductTableMap; * @method array findByProductId(int $product_id) Return ChildFeatureProduct objects filtered by the product_id column * @method array findByFeatureId(int $feature_id) Return ChildFeatureProduct objects filtered by the feature_id column * @method array findByFeatureAvId(int $feature_av_id) Return ChildFeatureProduct objects filtered by the feature_av_id column - * @method array findByByDefault(string $by_default) Return ChildFeatureProduct objects filtered by the by_default column + * @method array findByFreeTextValue(string $free_text_value) Return ChildFeatureProduct objects filtered by the free_text_value column * @method array findByPosition(int $position) Return ChildFeatureProduct objects filtered by the position column * @method array findByCreatedAt(string $created_at) Return ChildFeatureProduct objects filtered by the created_at column * @method array findByUpdatedAt(string $updated_at) Return ChildFeatureProduct objects filtered by the updated_at column @@ -163,7 +163,7 @@ abstract class FeatureProductQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, PRODUCT_ID, FEATURE_ID, FEATURE_AV_ID, BY_DEFAULT, POSITION, CREATED_AT, UPDATED_AT FROM feature_product WHERE ID = :p0'; + $sql = 'SELECT ID, PRODUCT_ID, FEATURE_ID, FEATURE_AV_ID, FREE_TEXT_VALUE, POSITION, CREATED_AT, UPDATED_AT FROM feature_product WHERE ID = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); @@ -423,32 +423,32 @@ abstract class FeatureProductQuery extends ModelCriteria } /** - * Filter the query on the by_default column + * Filter the query on the free_text_value column * * Example usage: * - * $query->filterByByDefault('fooValue'); // WHERE by_default = 'fooValue' - * $query->filterByByDefault('%fooValue%'); // WHERE by_default LIKE '%fooValue%' + * $query->filterByFreeTextValue('fooValue'); // WHERE free_text_value = 'fooValue' + * $query->filterByFreeTextValue('%fooValue%'); // WHERE free_text_value LIKE '%fooValue%' * * - * @param string $byDefault The value to use as filter. + * @param string $freeTextValue The value to use as filter. * Accepts wildcards (* and % trigger a LIKE) * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return ChildFeatureProductQuery The current query, for fluid interface */ - public function filterByByDefault($byDefault = null, $comparison = null) + public function filterByFreeTextValue($freeTextValue = null, $comparison = null) { if (null === $comparison) { - if (is_array($byDefault)) { + if (is_array($freeTextValue)) { $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $byDefault)) { - $byDefault = str_replace('*', '%', $byDefault); + } elseif (preg_match('/[\%\*]/', $freeTextValue)) { + $freeTextValue = str_replace('*', '%', $freeTextValue); $comparison = Criteria::LIKE; } } - return $this->addUsingAlias(FeatureProductTableMap::BY_DEFAULT, $byDefault, $comparison); + return $this->addUsingAlias(FeatureProductTableMap::FREE_TEXT_VALUE, $freeTextValue, $comparison); } /** diff --git a/core/lib/Thelia/Model/Base/OrderProduct.php b/core/lib/Thelia/Model/Base/OrderProduct.php index 2bf9c7ace..6ff03d427 100644 --- a/core/lib/Thelia/Model/Base/OrderProduct.php +++ b/core/lib/Thelia/Model/Base/OrderProduct.php @@ -18,10 +18,12 @@ use Propel\Runtime\Map\TableMap; use Propel\Runtime\Parser\AbstractParser; use Propel\Runtime\Util\PropelDateTime; use Thelia\Model\Order as ChildOrder; -use Thelia\Model\OrderFeature as ChildOrderFeature; -use Thelia\Model\OrderFeatureQuery as ChildOrderFeatureQuery; use Thelia\Model\OrderProduct as ChildOrderProduct; +use Thelia\Model\OrderProductAttributeCombination as ChildOrderProductAttributeCombination; +use Thelia\Model\OrderProductAttributeCombinationQuery as ChildOrderProductAttributeCombinationQuery; use Thelia\Model\OrderProductQuery as ChildOrderProductQuery; +use Thelia\Model\OrderProductTax as ChildOrderProductTax; +use Thelia\Model\OrderProductTaxQuery as ChildOrderProductTaxQuery; use Thelia\Model\OrderQuery as ChildOrderQuery; use Thelia\Model\Map\OrderProductTableMap; @@ -77,12 +79,24 @@ abstract class OrderProduct implements ActiveRecordInterface */ protected $product_ref; + /** + * The value for the product_sale_elements_ref field. + * @var string + */ + protected $product_sale_elements_ref; + /** * The value for the title field. * @var string */ protected $title; + /** + * The value for the chapo field. + * @var string + */ + protected $chapo; + /** * The value for the description field. * @var string @@ -90,10 +104,10 @@ abstract class OrderProduct implements ActiveRecordInterface protected $description; /** - * The value for the chapo field. + * The value for the postscriptum field. * @var string */ - protected $chapo; + protected $postscriptum; /** * The value for the quantity field. @@ -108,10 +122,40 @@ abstract class OrderProduct implements ActiveRecordInterface protected $price; /** - * The value for the tax field. - * @var double + * The value for the promo_price field. + * @var string */ - protected $tax; + protected $promo_price; + + /** + * The value for the was_new field. + * @var int + */ + protected $was_new; + + /** + * The value for the was_in_promo field. + * @var int + */ + protected $was_in_promo; + + /** + * The value for the weight field. + * @var string + */ + protected $weight; + + /** + * The value for the tax_rule_title field. + * @var string + */ + protected $tax_rule_title; + + /** + * The value for the tax_rule_description field. + * @var string + */ + protected $tax_rule_description; /** * The value for the parent field. @@ -137,10 +181,16 @@ abstract class OrderProduct implements ActiveRecordInterface protected $aOrder; /** - * @var ObjectCollection|ChildOrderFeature[] Collection to store aggregation of ChildOrderFeature objects. + * @var ObjectCollection|ChildOrderProductAttributeCombination[] Collection to store aggregation of ChildOrderProductAttributeCombination objects. */ - protected $collOrderFeatures; - protected $collOrderFeaturesPartial; + protected $collOrderProductAttributeCombinations; + protected $collOrderProductAttributeCombinationsPartial; + + /** + * @var ObjectCollection|ChildOrderProductTax[] Collection to store aggregation of ChildOrderProductTax objects. + */ + protected $collOrderProductTaxes; + protected $collOrderProductTaxesPartial; /** * Flag to prevent endless save loop, if this object is referenced @@ -154,7 +204,13 @@ abstract class OrderProduct implements ActiveRecordInterface * An array of objects scheduled for deletion. * @var ObjectCollection */ - protected $orderFeaturesScheduledForDeletion = null; + protected $orderProductAttributeCombinationsScheduledForDeletion = null; + + /** + * An array of objects scheduled for deletion. + * @var ObjectCollection + */ + protected $orderProductTaxesScheduledForDeletion = null; /** * Initializes internal state of Thelia\Model\Base\OrderProduct object. @@ -443,6 +499,17 @@ abstract class OrderProduct implements ActiveRecordInterface return $this->product_ref; } + /** + * Get the [product_sale_elements_ref] column value. + * + * @return string + */ + public function getProductSaleElementsRef() + { + + return $this->product_sale_elements_ref; + } + /** * Get the [title] column value. * @@ -454,6 +521,17 @@ abstract class OrderProduct implements ActiveRecordInterface return $this->title; } + /** + * Get the [chapo] column value. + * + * @return string + */ + public function getChapo() + { + + return $this->chapo; + } + /** * Get the [description] column value. * @@ -466,14 +544,14 @@ abstract class OrderProduct implements ActiveRecordInterface } /** - * Get the [chapo] column value. + * Get the [postscriptum] column value. * * @return string */ - public function getChapo() + public function getPostscriptum() { - return $this->chapo; + return $this->postscriptum; } /** @@ -499,19 +577,74 @@ abstract class OrderProduct implements ActiveRecordInterface } /** - * Get the [tax] column value. + * Get the [promo_price] column value. * - * @return double + * @return string */ - public function getTax() + public function getPromoPrice() { - return $this->tax; + return $this->promo_price; + } + + /** + * Get the [was_new] column value. + * + * @return int + */ + public function getWasNew() + { + + return $this->was_new; + } + + /** + * Get the [was_in_promo] column value. + * + * @return int + */ + public function getWasInPromo() + { + + return $this->was_in_promo; + } + + /** + * Get the [weight] column value. + * + * @return string + */ + public function getWeight() + { + + return $this->weight; + } + + /** + * Get the [tax_rule_title] column value. + * + * @return string + */ + public function getTaxRuleTitle() + { + + return $this->tax_rule_title; + } + + /** + * Get the [tax_rule_description] column value. + * + * @return string + */ + public function getTaxRuleDescription() + { + + return $this->tax_rule_description; } /** * Get the [parent] column value. - * + * not managed yet * @return int */ public function getParent() @@ -627,6 +760,27 @@ abstract class OrderProduct implements ActiveRecordInterface return $this; } // setProductRef() + /** + * Set the value of [product_sale_elements_ref] column. + * + * @param string $v new value + * @return \Thelia\Model\OrderProduct The current object (for fluent API support) + */ + public function setProductSaleElementsRef($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->product_sale_elements_ref !== $v) { + $this->product_sale_elements_ref = $v; + $this->modifiedColumns[] = OrderProductTableMap::PRODUCT_SALE_ELEMENTS_REF; + } + + + return $this; + } // setProductSaleElementsRef() + /** * Set the value of [title] column. * @@ -648,6 +802,27 @@ abstract class OrderProduct implements ActiveRecordInterface return $this; } // setTitle() + /** + * Set the value of [chapo] column. + * + * @param string $v new value + * @return \Thelia\Model\OrderProduct The current object (for fluent API support) + */ + public function setChapo($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->chapo !== $v) { + $this->chapo = $v; + $this->modifiedColumns[] = OrderProductTableMap::CHAPO; + } + + + return $this; + } // setChapo() + /** * Set the value of [description] column. * @@ -670,25 +845,25 @@ abstract class OrderProduct implements ActiveRecordInterface } // setDescription() /** - * Set the value of [chapo] column. + * Set the value of [postscriptum] column. * * @param string $v new value * @return \Thelia\Model\OrderProduct The current object (for fluent API support) */ - public function setChapo($v) + public function setPostscriptum($v) { if ($v !== null) { $v = (string) $v; } - if ($this->chapo !== $v) { - $this->chapo = $v; - $this->modifiedColumns[] = OrderProductTableMap::CHAPO; + if ($this->postscriptum !== $v) { + $this->postscriptum = $v; + $this->modifiedColumns[] = OrderProductTableMap::POSTSCRIPTUM; } return $this; - } // setChapo() + } // setPostscriptum() /** * Set the value of [quantity] column. @@ -733,29 +908,134 @@ abstract class OrderProduct implements ActiveRecordInterface } // setPrice() /** - * Set the value of [tax] column. + * Set the value of [promo_price] column. * - * @param double $v new value + * @param string $v new value * @return \Thelia\Model\OrderProduct The current object (for fluent API support) */ - public function setTax($v) + public function setPromoPrice($v) { if ($v !== null) { - $v = (double) $v; + $v = (string) $v; } - if ($this->tax !== $v) { - $this->tax = $v; - $this->modifiedColumns[] = OrderProductTableMap::TAX; + if ($this->promo_price !== $v) { + $this->promo_price = $v; + $this->modifiedColumns[] = OrderProductTableMap::PROMO_PRICE; } return $this; - } // setTax() + } // setPromoPrice() + + /** + * Set the value of [was_new] column. + * + * @param int $v new value + * @return \Thelia\Model\OrderProduct The current object (for fluent API support) + */ + public function setWasNew($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->was_new !== $v) { + $this->was_new = $v; + $this->modifiedColumns[] = OrderProductTableMap::WAS_NEW; + } + + + return $this; + } // setWasNew() + + /** + * Set the value of [was_in_promo] column. + * + * @param int $v new value + * @return \Thelia\Model\OrderProduct The current object (for fluent API support) + */ + public function setWasInPromo($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->was_in_promo !== $v) { + $this->was_in_promo = $v; + $this->modifiedColumns[] = OrderProductTableMap::WAS_IN_PROMO; + } + + + return $this; + } // setWasInPromo() + + /** + * Set the value of [weight] column. + * + * @param string $v new value + * @return \Thelia\Model\OrderProduct The current object (for fluent API support) + */ + public function setWeight($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->weight !== $v) { + $this->weight = $v; + $this->modifiedColumns[] = OrderProductTableMap::WEIGHT; + } + + + return $this; + } // setWeight() + + /** + * Set the value of [tax_rule_title] column. + * + * @param string $v new value + * @return \Thelia\Model\OrderProduct The current object (for fluent API support) + */ + public function setTaxRuleTitle($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->tax_rule_title !== $v) { + $this->tax_rule_title = $v; + $this->modifiedColumns[] = OrderProductTableMap::TAX_RULE_TITLE; + } + + + return $this; + } // setTaxRuleTitle() + + /** + * Set the value of [tax_rule_description] column. + * + * @param string $v new value + * @return \Thelia\Model\OrderProduct The current object (for fluent API support) + */ + public function setTaxRuleDescription($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->tax_rule_description !== $v) { + $this->tax_rule_description = $v; + $this->modifiedColumns[] = OrderProductTableMap::TAX_RULE_DESCRIPTION; + } + + + return $this; + } // setTaxRuleDescription() /** * Set the value of [parent] column. - * + * not managed yet * @param int $v new value * @return \Thelia\Model\OrderProduct The current object (for fluent API support) */ @@ -862,34 +1142,55 @@ abstract class OrderProduct implements ActiveRecordInterface $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : OrderProductTableMap::translateFieldName('ProductRef', TableMap::TYPE_PHPNAME, $indexType)]; $this->product_ref = (null !== $col) ? (string) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : OrderProductTableMap::translateFieldName('Title', TableMap::TYPE_PHPNAME, $indexType)]; - $this->title = (null !== $col) ? (string) $col : null; + $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : OrderProductTableMap::translateFieldName('ProductSaleElementsRef', TableMap::TYPE_PHPNAME, $indexType)]; + $this->product_sale_elements_ref = (null !== $col) ? (string) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : OrderProductTableMap::translateFieldName('Description', TableMap::TYPE_PHPNAME, $indexType)]; - $this->description = (null !== $col) ? (string) $col : null; + $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : OrderProductTableMap::translateFieldName('Title', TableMap::TYPE_PHPNAME, $indexType)]; + $this->title = (null !== $col) ? (string) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : OrderProductTableMap::translateFieldName('Chapo', TableMap::TYPE_PHPNAME, $indexType)]; $this->chapo = (null !== $col) ? (string) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : OrderProductTableMap::translateFieldName('Quantity', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : OrderProductTableMap::translateFieldName('Description', TableMap::TYPE_PHPNAME, $indexType)]; + $this->description = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : OrderProductTableMap::translateFieldName('Postscriptum', TableMap::TYPE_PHPNAME, $indexType)]; + $this->postscriptum = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : OrderProductTableMap::translateFieldName('Quantity', TableMap::TYPE_PHPNAME, $indexType)]; $this->quantity = (null !== $col) ? (double) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : OrderProductTableMap::translateFieldName('Price', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : OrderProductTableMap::translateFieldName('Price', TableMap::TYPE_PHPNAME, $indexType)]; $this->price = (null !== $col) ? (double) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : OrderProductTableMap::translateFieldName('Tax', TableMap::TYPE_PHPNAME, $indexType)]; - $this->tax = (null !== $col) ? (double) $col : null; + $col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : OrderProductTableMap::translateFieldName('PromoPrice', TableMap::TYPE_PHPNAME, $indexType)]; + $this->promo_price = (null !== $col) ? (string) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : OrderProductTableMap::translateFieldName('Parent', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 11 + $startcol : OrderProductTableMap::translateFieldName('WasNew', TableMap::TYPE_PHPNAME, $indexType)]; + $this->was_new = (null !== $col) ? (int) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 12 + $startcol : OrderProductTableMap::translateFieldName('WasInPromo', TableMap::TYPE_PHPNAME, $indexType)]; + $this->was_in_promo = (null !== $col) ? (int) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 13 + $startcol : OrderProductTableMap::translateFieldName('Weight', TableMap::TYPE_PHPNAME, $indexType)]; + $this->weight = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 14 + $startcol : OrderProductTableMap::translateFieldName('TaxRuleTitle', TableMap::TYPE_PHPNAME, $indexType)]; + $this->tax_rule_title = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 15 + $startcol : OrderProductTableMap::translateFieldName('TaxRuleDescription', TableMap::TYPE_PHPNAME, $indexType)]; + $this->tax_rule_description = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 16 + $startcol : OrderProductTableMap::translateFieldName('Parent', TableMap::TYPE_PHPNAME, $indexType)]; $this->parent = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : OrderProductTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 17 + $startcol : OrderProductTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } $this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 11 + $startcol : OrderProductTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 18 + $startcol : OrderProductTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } @@ -902,7 +1203,7 @@ abstract class OrderProduct implements ActiveRecordInterface $this->ensureConsistency(); } - return $startcol + 12; // 12 = OrderProductTableMap::NUM_HYDRATE_COLUMNS. + return $startcol + 19; // 19 = OrderProductTableMap::NUM_HYDRATE_COLUMNS. } catch (Exception $e) { throw new PropelException("Error populating \Thelia\Model\OrderProduct object", 0, $e); @@ -967,7 +1268,9 @@ abstract class OrderProduct implements ActiveRecordInterface if ($deep) { // also de-associate any related objects? $this->aOrder = null; - $this->collOrderFeatures = null; + $this->collOrderProductAttributeCombinations = null; + + $this->collOrderProductTaxes = null; } // if (deep) } @@ -1114,17 +1417,34 @@ abstract class OrderProduct implements ActiveRecordInterface $this->resetModified(); } - if ($this->orderFeaturesScheduledForDeletion !== null) { - if (!$this->orderFeaturesScheduledForDeletion->isEmpty()) { - \Thelia\Model\OrderFeatureQuery::create() - ->filterByPrimaryKeys($this->orderFeaturesScheduledForDeletion->getPrimaryKeys(false)) + if ($this->orderProductAttributeCombinationsScheduledForDeletion !== null) { + if (!$this->orderProductAttributeCombinationsScheduledForDeletion->isEmpty()) { + \Thelia\Model\OrderProductAttributeCombinationQuery::create() + ->filterByPrimaryKeys($this->orderProductAttributeCombinationsScheduledForDeletion->getPrimaryKeys(false)) ->delete($con); - $this->orderFeaturesScheduledForDeletion = null; + $this->orderProductAttributeCombinationsScheduledForDeletion = null; } } - if ($this->collOrderFeatures !== null) { - foreach ($this->collOrderFeatures as $referrerFK) { + if ($this->collOrderProductAttributeCombinations !== null) { + foreach ($this->collOrderProductAttributeCombinations as $referrerFK) { + if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->orderProductTaxesScheduledForDeletion !== null) { + if (!$this->orderProductTaxesScheduledForDeletion->isEmpty()) { + \Thelia\Model\OrderProductTaxQuery::create() + ->filterByPrimaryKeys($this->orderProductTaxesScheduledForDeletion->getPrimaryKeys(false)) + ->delete($con); + $this->orderProductTaxesScheduledForDeletion = null; + } + } + + if ($this->collOrderProductTaxes !== null) { + foreach ($this->collOrderProductTaxes as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } @@ -1166,14 +1486,20 @@ abstract class OrderProduct implements ActiveRecordInterface if ($this->isColumnModified(OrderProductTableMap::PRODUCT_REF)) { $modifiedColumns[':p' . $index++] = 'PRODUCT_REF'; } + if ($this->isColumnModified(OrderProductTableMap::PRODUCT_SALE_ELEMENTS_REF)) { + $modifiedColumns[':p' . $index++] = 'PRODUCT_SALE_ELEMENTS_REF'; + } if ($this->isColumnModified(OrderProductTableMap::TITLE)) { $modifiedColumns[':p' . $index++] = 'TITLE'; } + if ($this->isColumnModified(OrderProductTableMap::CHAPO)) { + $modifiedColumns[':p' . $index++] = 'CHAPO'; + } if ($this->isColumnModified(OrderProductTableMap::DESCRIPTION)) { $modifiedColumns[':p' . $index++] = 'DESCRIPTION'; } - if ($this->isColumnModified(OrderProductTableMap::CHAPO)) { - $modifiedColumns[':p' . $index++] = 'CHAPO'; + if ($this->isColumnModified(OrderProductTableMap::POSTSCRIPTUM)) { + $modifiedColumns[':p' . $index++] = 'POSTSCRIPTUM'; } if ($this->isColumnModified(OrderProductTableMap::QUANTITY)) { $modifiedColumns[':p' . $index++] = 'QUANTITY'; @@ -1181,8 +1507,23 @@ abstract class OrderProduct implements ActiveRecordInterface if ($this->isColumnModified(OrderProductTableMap::PRICE)) { $modifiedColumns[':p' . $index++] = 'PRICE'; } - if ($this->isColumnModified(OrderProductTableMap::TAX)) { - $modifiedColumns[':p' . $index++] = 'TAX'; + if ($this->isColumnModified(OrderProductTableMap::PROMO_PRICE)) { + $modifiedColumns[':p' . $index++] = 'PROMO_PRICE'; + } + if ($this->isColumnModified(OrderProductTableMap::WAS_NEW)) { + $modifiedColumns[':p' . $index++] = 'WAS_NEW'; + } + if ($this->isColumnModified(OrderProductTableMap::WAS_IN_PROMO)) { + $modifiedColumns[':p' . $index++] = 'WAS_IN_PROMO'; + } + if ($this->isColumnModified(OrderProductTableMap::WEIGHT)) { + $modifiedColumns[':p' . $index++] = 'WEIGHT'; + } + if ($this->isColumnModified(OrderProductTableMap::TAX_RULE_TITLE)) { + $modifiedColumns[':p' . $index++] = 'TAX_RULE_TITLE'; + } + if ($this->isColumnModified(OrderProductTableMap::TAX_RULE_DESCRIPTION)) { + $modifiedColumns[':p' . $index++] = 'TAX_RULE_DESCRIPTION'; } if ($this->isColumnModified(OrderProductTableMap::PARENT)) { $modifiedColumns[':p' . $index++] = 'PARENT'; @@ -1213,14 +1554,20 @@ abstract class OrderProduct implements ActiveRecordInterface case 'PRODUCT_REF': $stmt->bindValue($identifier, $this->product_ref, PDO::PARAM_STR); break; + case 'PRODUCT_SALE_ELEMENTS_REF': + $stmt->bindValue($identifier, $this->product_sale_elements_ref, PDO::PARAM_STR); + break; case 'TITLE': $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); break; + case 'CHAPO': + $stmt->bindValue($identifier, $this->chapo, PDO::PARAM_STR); + break; case 'DESCRIPTION': $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); break; - case 'CHAPO': - $stmt->bindValue($identifier, $this->chapo, PDO::PARAM_STR); + case 'POSTSCRIPTUM': + $stmt->bindValue($identifier, $this->postscriptum, PDO::PARAM_STR); break; case 'QUANTITY': $stmt->bindValue($identifier, $this->quantity, PDO::PARAM_STR); @@ -1228,8 +1575,23 @@ abstract class OrderProduct implements ActiveRecordInterface case 'PRICE': $stmt->bindValue($identifier, $this->price, PDO::PARAM_STR); break; - case 'TAX': - $stmt->bindValue($identifier, $this->tax, PDO::PARAM_STR); + case 'PROMO_PRICE': + $stmt->bindValue($identifier, $this->promo_price, PDO::PARAM_STR); + break; + case 'WAS_NEW': + $stmt->bindValue($identifier, $this->was_new, PDO::PARAM_INT); + break; + case 'WAS_IN_PROMO': + $stmt->bindValue($identifier, $this->was_in_promo, PDO::PARAM_INT); + break; + case 'WEIGHT': + $stmt->bindValue($identifier, $this->weight, PDO::PARAM_STR); + break; + case 'TAX_RULE_TITLE': + $stmt->bindValue($identifier, $this->tax_rule_title, PDO::PARAM_STR); + break; + case 'TAX_RULE_DESCRIPTION': + $stmt->bindValue($identifier, $this->tax_rule_description, PDO::PARAM_STR); break; case 'PARENT': $stmt->bindValue($identifier, $this->parent, PDO::PARAM_INT); @@ -1312,30 +1674,51 @@ abstract class OrderProduct implements ActiveRecordInterface return $this->getProductRef(); break; case 3: - return $this->getTitle(); + return $this->getProductSaleElementsRef(); break; case 4: - return $this->getDescription(); + return $this->getTitle(); break; case 5: return $this->getChapo(); break; case 6: - return $this->getQuantity(); + return $this->getDescription(); break; case 7: - return $this->getPrice(); + return $this->getPostscriptum(); break; case 8: - return $this->getTax(); + return $this->getQuantity(); break; case 9: - return $this->getParent(); + return $this->getPrice(); break; case 10: - return $this->getCreatedAt(); + return $this->getPromoPrice(); break; case 11: + return $this->getWasNew(); + break; + case 12: + return $this->getWasInPromo(); + break; + case 13: + return $this->getWeight(); + break; + case 14: + return $this->getTaxRuleTitle(); + break; + case 15: + return $this->getTaxRuleDescription(); + break; + case 16: + return $this->getParent(); + break; + case 17: + return $this->getCreatedAt(); + break; + case 18: return $this->getUpdatedAt(); break; default: @@ -1370,15 +1753,22 @@ abstract class OrderProduct implements ActiveRecordInterface $keys[0] => $this->getId(), $keys[1] => $this->getOrderId(), $keys[2] => $this->getProductRef(), - $keys[3] => $this->getTitle(), - $keys[4] => $this->getDescription(), + $keys[3] => $this->getProductSaleElementsRef(), + $keys[4] => $this->getTitle(), $keys[5] => $this->getChapo(), - $keys[6] => $this->getQuantity(), - $keys[7] => $this->getPrice(), - $keys[8] => $this->getTax(), - $keys[9] => $this->getParent(), - $keys[10] => $this->getCreatedAt(), - $keys[11] => $this->getUpdatedAt(), + $keys[6] => $this->getDescription(), + $keys[7] => $this->getPostscriptum(), + $keys[8] => $this->getQuantity(), + $keys[9] => $this->getPrice(), + $keys[10] => $this->getPromoPrice(), + $keys[11] => $this->getWasNew(), + $keys[12] => $this->getWasInPromo(), + $keys[13] => $this->getWeight(), + $keys[14] => $this->getTaxRuleTitle(), + $keys[15] => $this->getTaxRuleDescription(), + $keys[16] => $this->getParent(), + $keys[17] => $this->getCreatedAt(), + $keys[18] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; foreach($virtualColumns as $key => $virtualColumn) @@ -1390,8 +1780,11 @@ abstract class OrderProduct implements ActiveRecordInterface if (null !== $this->aOrder) { $result['Order'] = $this->aOrder->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } - if (null !== $this->collOrderFeatures) { - $result['OrderFeatures'] = $this->collOrderFeatures->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); + if (null !== $this->collOrderProductAttributeCombinations) { + $result['OrderProductAttributeCombinations'] = $this->collOrderProductAttributeCombinations->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); + } + if (null !== $this->collOrderProductTaxes) { + $result['OrderProductTaxes'] = $this->collOrderProductTaxes->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } } @@ -1437,30 +1830,51 @@ abstract class OrderProduct implements ActiveRecordInterface $this->setProductRef($value); break; case 3: - $this->setTitle($value); + $this->setProductSaleElementsRef($value); break; case 4: - $this->setDescription($value); + $this->setTitle($value); break; case 5: $this->setChapo($value); break; case 6: - $this->setQuantity($value); + $this->setDescription($value); break; case 7: - $this->setPrice($value); + $this->setPostscriptum($value); break; case 8: - $this->setTax($value); + $this->setQuantity($value); break; case 9: - $this->setParent($value); + $this->setPrice($value); break; case 10: - $this->setCreatedAt($value); + $this->setPromoPrice($value); break; case 11: + $this->setWasNew($value); + break; + case 12: + $this->setWasInPromo($value); + break; + case 13: + $this->setWeight($value); + break; + case 14: + $this->setTaxRuleTitle($value); + break; + case 15: + $this->setTaxRuleDescription($value); + break; + case 16: + $this->setParent($value); + break; + case 17: + $this->setCreatedAt($value); + break; + case 18: $this->setUpdatedAt($value); break; } // switch() @@ -1490,15 +1904,22 @@ abstract class OrderProduct implements ActiveRecordInterface if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); if (array_key_exists($keys[1], $arr)) $this->setOrderId($arr[$keys[1]]); if (array_key_exists($keys[2], $arr)) $this->setProductRef($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setTitle($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setDescription($arr[$keys[4]]); + if (array_key_exists($keys[3], $arr)) $this->setProductSaleElementsRef($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setTitle($arr[$keys[4]]); if (array_key_exists($keys[5], $arr)) $this->setChapo($arr[$keys[5]]); - if (array_key_exists($keys[6], $arr)) $this->setQuantity($arr[$keys[6]]); - if (array_key_exists($keys[7], $arr)) $this->setPrice($arr[$keys[7]]); - if (array_key_exists($keys[8], $arr)) $this->setTax($arr[$keys[8]]); - if (array_key_exists($keys[9], $arr)) $this->setParent($arr[$keys[9]]); - if (array_key_exists($keys[10], $arr)) $this->setCreatedAt($arr[$keys[10]]); - if (array_key_exists($keys[11], $arr)) $this->setUpdatedAt($arr[$keys[11]]); + if (array_key_exists($keys[6], $arr)) $this->setDescription($arr[$keys[6]]); + if (array_key_exists($keys[7], $arr)) $this->setPostscriptum($arr[$keys[7]]); + if (array_key_exists($keys[8], $arr)) $this->setQuantity($arr[$keys[8]]); + if (array_key_exists($keys[9], $arr)) $this->setPrice($arr[$keys[9]]); + if (array_key_exists($keys[10], $arr)) $this->setPromoPrice($arr[$keys[10]]); + if (array_key_exists($keys[11], $arr)) $this->setWasNew($arr[$keys[11]]); + if (array_key_exists($keys[12], $arr)) $this->setWasInPromo($arr[$keys[12]]); + if (array_key_exists($keys[13], $arr)) $this->setWeight($arr[$keys[13]]); + if (array_key_exists($keys[14], $arr)) $this->setTaxRuleTitle($arr[$keys[14]]); + if (array_key_exists($keys[15], $arr)) $this->setTaxRuleDescription($arr[$keys[15]]); + if (array_key_exists($keys[16], $arr)) $this->setParent($arr[$keys[16]]); + if (array_key_exists($keys[17], $arr)) $this->setCreatedAt($arr[$keys[17]]); + if (array_key_exists($keys[18], $arr)) $this->setUpdatedAt($arr[$keys[18]]); } /** @@ -1513,12 +1934,19 @@ abstract class OrderProduct implements ActiveRecordInterface if ($this->isColumnModified(OrderProductTableMap::ID)) $criteria->add(OrderProductTableMap::ID, $this->id); if ($this->isColumnModified(OrderProductTableMap::ORDER_ID)) $criteria->add(OrderProductTableMap::ORDER_ID, $this->order_id); if ($this->isColumnModified(OrderProductTableMap::PRODUCT_REF)) $criteria->add(OrderProductTableMap::PRODUCT_REF, $this->product_ref); + if ($this->isColumnModified(OrderProductTableMap::PRODUCT_SALE_ELEMENTS_REF)) $criteria->add(OrderProductTableMap::PRODUCT_SALE_ELEMENTS_REF, $this->product_sale_elements_ref); if ($this->isColumnModified(OrderProductTableMap::TITLE)) $criteria->add(OrderProductTableMap::TITLE, $this->title); - if ($this->isColumnModified(OrderProductTableMap::DESCRIPTION)) $criteria->add(OrderProductTableMap::DESCRIPTION, $this->description); if ($this->isColumnModified(OrderProductTableMap::CHAPO)) $criteria->add(OrderProductTableMap::CHAPO, $this->chapo); + if ($this->isColumnModified(OrderProductTableMap::DESCRIPTION)) $criteria->add(OrderProductTableMap::DESCRIPTION, $this->description); + if ($this->isColumnModified(OrderProductTableMap::POSTSCRIPTUM)) $criteria->add(OrderProductTableMap::POSTSCRIPTUM, $this->postscriptum); if ($this->isColumnModified(OrderProductTableMap::QUANTITY)) $criteria->add(OrderProductTableMap::QUANTITY, $this->quantity); if ($this->isColumnModified(OrderProductTableMap::PRICE)) $criteria->add(OrderProductTableMap::PRICE, $this->price); - if ($this->isColumnModified(OrderProductTableMap::TAX)) $criteria->add(OrderProductTableMap::TAX, $this->tax); + if ($this->isColumnModified(OrderProductTableMap::PROMO_PRICE)) $criteria->add(OrderProductTableMap::PROMO_PRICE, $this->promo_price); + if ($this->isColumnModified(OrderProductTableMap::WAS_NEW)) $criteria->add(OrderProductTableMap::WAS_NEW, $this->was_new); + if ($this->isColumnModified(OrderProductTableMap::WAS_IN_PROMO)) $criteria->add(OrderProductTableMap::WAS_IN_PROMO, $this->was_in_promo); + if ($this->isColumnModified(OrderProductTableMap::WEIGHT)) $criteria->add(OrderProductTableMap::WEIGHT, $this->weight); + if ($this->isColumnModified(OrderProductTableMap::TAX_RULE_TITLE)) $criteria->add(OrderProductTableMap::TAX_RULE_TITLE, $this->tax_rule_title); + if ($this->isColumnModified(OrderProductTableMap::TAX_RULE_DESCRIPTION)) $criteria->add(OrderProductTableMap::TAX_RULE_DESCRIPTION, $this->tax_rule_description); if ($this->isColumnModified(OrderProductTableMap::PARENT)) $criteria->add(OrderProductTableMap::PARENT, $this->parent); if ($this->isColumnModified(OrderProductTableMap::CREATED_AT)) $criteria->add(OrderProductTableMap::CREATED_AT, $this->created_at); if ($this->isColumnModified(OrderProductTableMap::UPDATED_AT)) $criteria->add(OrderProductTableMap::UPDATED_AT, $this->updated_at); @@ -1587,12 +2015,19 @@ abstract class OrderProduct implements ActiveRecordInterface { $copyObj->setOrderId($this->getOrderId()); $copyObj->setProductRef($this->getProductRef()); + $copyObj->setProductSaleElementsRef($this->getProductSaleElementsRef()); $copyObj->setTitle($this->getTitle()); - $copyObj->setDescription($this->getDescription()); $copyObj->setChapo($this->getChapo()); + $copyObj->setDescription($this->getDescription()); + $copyObj->setPostscriptum($this->getPostscriptum()); $copyObj->setQuantity($this->getQuantity()); $copyObj->setPrice($this->getPrice()); - $copyObj->setTax($this->getTax()); + $copyObj->setPromoPrice($this->getPromoPrice()); + $copyObj->setWasNew($this->getWasNew()); + $copyObj->setWasInPromo($this->getWasInPromo()); + $copyObj->setWeight($this->getWeight()); + $copyObj->setTaxRuleTitle($this->getTaxRuleTitle()); + $copyObj->setTaxRuleDescription($this->getTaxRuleDescription()); $copyObj->setParent($this->getParent()); $copyObj->setCreatedAt($this->getCreatedAt()); $copyObj->setUpdatedAt($this->getUpdatedAt()); @@ -1602,9 +2037,15 @@ abstract class OrderProduct implements ActiveRecordInterface // the getter/setter methods for fkey referrer objects. $copyObj->setNew(false); - foreach ($this->getOrderFeatures() as $relObj) { + foreach ($this->getOrderProductAttributeCombinations() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves - $copyObj->addOrderFeature($relObj->copy($deepCopy)); + $copyObj->addOrderProductAttributeCombination($relObj->copy($deepCopy)); + } + } + + foreach ($this->getOrderProductTaxes() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addOrderProductTax($relObj->copy($deepCopy)); } } @@ -1700,37 +2141,40 @@ abstract class OrderProduct implements ActiveRecordInterface */ public function initRelation($relationName) { - if ('OrderFeature' == $relationName) { - return $this->initOrderFeatures(); + if ('OrderProductAttributeCombination' == $relationName) { + return $this->initOrderProductAttributeCombinations(); + } + if ('OrderProductTax' == $relationName) { + return $this->initOrderProductTaxes(); } } /** - * Clears out the collOrderFeatures collection + * Clears out the collOrderProductAttributeCombinations collection * * This does not modify the database; however, it will remove any associated objects, causing * them to be refetched by subsequent calls to accessor method. * * @return void - * @see addOrderFeatures() + * @see addOrderProductAttributeCombinations() */ - public function clearOrderFeatures() + public function clearOrderProductAttributeCombinations() { - $this->collOrderFeatures = null; // important to set this to NULL since that means it is uninitialized + $this->collOrderProductAttributeCombinations = null; // important to set this to NULL since that means it is uninitialized } /** - * Reset is the collOrderFeatures collection loaded partially. + * Reset is the collOrderProductAttributeCombinations collection loaded partially. */ - public function resetPartialOrderFeatures($v = true) + public function resetPartialOrderProductAttributeCombinations($v = true) { - $this->collOrderFeaturesPartial = $v; + $this->collOrderProductAttributeCombinationsPartial = $v; } /** - * Initializes the collOrderFeatures collection. + * Initializes the collOrderProductAttributeCombinations collection. * - * By default this just sets the collOrderFeatures collection to an empty array (like clearcollOrderFeatures()); + * By default this just sets the collOrderProductAttributeCombinations collection to an empty array (like clearcollOrderProductAttributeCombinations()); * however, you may wish to override this method in your stub class to provide setting appropriate * to your application -- for example, setting the initial array to the values stored in database. * @@ -1739,17 +2183,17 @@ abstract class OrderProduct implements ActiveRecordInterface * * @return void */ - public function initOrderFeatures($overrideExisting = true) + public function initOrderProductAttributeCombinations($overrideExisting = true) { - if (null !== $this->collOrderFeatures && !$overrideExisting) { + if (null !== $this->collOrderProductAttributeCombinations && !$overrideExisting) { return; } - $this->collOrderFeatures = new ObjectCollection(); - $this->collOrderFeatures->setModel('\Thelia\Model\OrderFeature'); + $this->collOrderProductAttributeCombinations = new ObjectCollection(); + $this->collOrderProductAttributeCombinations->setModel('\Thelia\Model\OrderProductAttributeCombination'); } /** - * Gets an array of ChildOrderFeature objects which contain a foreign key that references this object. + * Gets an array of ChildOrderProductAttributeCombination objects which contain a foreign key that references this object. * * If the $criteria is not null, it is used to always fetch the results from the database. * Otherwise the results are fetched from the database the first time, then cached. @@ -1759,109 +2203,109 @@ abstract class OrderProduct implements ActiveRecordInterface * * @param Criteria $criteria optional Criteria object to narrow the query * @param ConnectionInterface $con optional connection object - * @return Collection|ChildOrderFeature[] List of ChildOrderFeature objects + * @return Collection|ChildOrderProductAttributeCombination[] List of ChildOrderProductAttributeCombination objects * @throws PropelException */ - public function getOrderFeatures($criteria = null, ConnectionInterface $con = null) + public function getOrderProductAttributeCombinations($criteria = null, ConnectionInterface $con = null) { - $partial = $this->collOrderFeaturesPartial && !$this->isNew(); - if (null === $this->collOrderFeatures || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collOrderFeatures) { + $partial = $this->collOrderProductAttributeCombinationsPartial && !$this->isNew(); + if (null === $this->collOrderProductAttributeCombinations || null !== $criteria || $partial) { + if ($this->isNew() && null === $this->collOrderProductAttributeCombinations) { // return empty collection - $this->initOrderFeatures(); + $this->initOrderProductAttributeCombinations(); } else { - $collOrderFeatures = ChildOrderFeatureQuery::create(null, $criteria) + $collOrderProductAttributeCombinations = ChildOrderProductAttributeCombinationQuery::create(null, $criteria) ->filterByOrderProduct($this) ->find($con); if (null !== $criteria) { - if (false !== $this->collOrderFeaturesPartial && count($collOrderFeatures)) { - $this->initOrderFeatures(false); + if (false !== $this->collOrderProductAttributeCombinationsPartial && count($collOrderProductAttributeCombinations)) { + $this->initOrderProductAttributeCombinations(false); - foreach ($collOrderFeatures as $obj) { - if (false == $this->collOrderFeatures->contains($obj)) { - $this->collOrderFeatures->append($obj); + foreach ($collOrderProductAttributeCombinations as $obj) { + if (false == $this->collOrderProductAttributeCombinations->contains($obj)) { + $this->collOrderProductAttributeCombinations->append($obj); } } - $this->collOrderFeaturesPartial = true; + $this->collOrderProductAttributeCombinationsPartial = true; } - $collOrderFeatures->getInternalIterator()->rewind(); + $collOrderProductAttributeCombinations->getInternalIterator()->rewind(); - return $collOrderFeatures; + return $collOrderProductAttributeCombinations; } - if ($partial && $this->collOrderFeatures) { - foreach ($this->collOrderFeatures as $obj) { + if ($partial && $this->collOrderProductAttributeCombinations) { + foreach ($this->collOrderProductAttributeCombinations as $obj) { if ($obj->isNew()) { - $collOrderFeatures[] = $obj; + $collOrderProductAttributeCombinations[] = $obj; } } } - $this->collOrderFeatures = $collOrderFeatures; - $this->collOrderFeaturesPartial = false; + $this->collOrderProductAttributeCombinations = $collOrderProductAttributeCombinations; + $this->collOrderProductAttributeCombinationsPartial = false; } } - return $this->collOrderFeatures; + return $this->collOrderProductAttributeCombinations; } /** - * Sets a collection of OrderFeature objects related by a one-to-many relationship + * Sets a collection of OrderProductAttributeCombination objects related by a one-to-many relationship * to the current object. * It will also schedule objects for deletion based on a diff between old objects (aka persisted) * and new objects from the given Propel collection. * - * @param Collection $orderFeatures A Propel collection. + * @param Collection $orderProductAttributeCombinations A Propel collection. * @param ConnectionInterface $con Optional connection object * @return ChildOrderProduct The current object (for fluent API support) */ - public function setOrderFeatures(Collection $orderFeatures, ConnectionInterface $con = null) + public function setOrderProductAttributeCombinations(Collection $orderProductAttributeCombinations, ConnectionInterface $con = null) { - $orderFeaturesToDelete = $this->getOrderFeatures(new Criteria(), $con)->diff($orderFeatures); + $orderProductAttributeCombinationsToDelete = $this->getOrderProductAttributeCombinations(new Criteria(), $con)->diff($orderProductAttributeCombinations); - $this->orderFeaturesScheduledForDeletion = $orderFeaturesToDelete; + $this->orderProductAttributeCombinationsScheduledForDeletion = $orderProductAttributeCombinationsToDelete; - foreach ($orderFeaturesToDelete as $orderFeatureRemoved) { - $orderFeatureRemoved->setOrderProduct(null); + foreach ($orderProductAttributeCombinationsToDelete as $orderProductAttributeCombinationRemoved) { + $orderProductAttributeCombinationRemoved->setOrderProduct(null); } - $this->collOrderFeatures = null; - foreach ($orderFeatures as $orderFeature) { - $this->addOrderFeature($orderFeature); + $this->collOrderProductAttributeCombinations = null; + foreach ($orderProductAttributeCombinations as $orderProductAttributeCombination) { + $this->addOrderProductAttributeCombination($orderProductAttributeCombination); } - $this->collOrderFeatures = $orderFeatures; - $this->collOrderFeaturesPartial = false; + $this->collOrderProductAttributeCombinations = $orderProductAttributeCombinations; + $this->collOrderProductAttributeCombinationsPartial = false; return $this; } /** - * Returns the number of related OrderFeature objects. + * Returns the number of related OrderProductAttributeCombination objects. * * @param Criteria $criteria * @param boolean $distinct * @param ConnectionInterface $con - * @return int Count of related OrderFeature objects. + * @return int Count of related OrderProductAttributeCombination objects. * @throws PropelException */ - public function countOrderFeatures(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) + public function countOrderProductAttributeCombinations(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) { - $partial = $this->collOrderFeaturesPartial && !$this->isNew(); - if (null === $this->collOrderFeatures || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collOrderFeatures) { + $partial = $this->collOrderProductAttributeCombinationsPartial && !$this->isNew(); + if (null === $this->collOrderProductAttributeCombinations || null !== $criteria || $partial) { + if ($this->isNew() && null === $this->collOrderProductAttributeCombinations) { return 0; } if ($partial && !$criteria) { - return count($this->getOrderFeatures()); + return count($this->getOrderProductAttributeCombinations()); } - $query = ChildOrderFeatureQuery::create(null, $criteria); + $query = ChildOrderProductAttributeCombinationQuery::create(null, $criteria); if ($distinct) { $query->distinct(); } @@ -1871,53 +2315,271 @@ abstract class OrderProduct implements ActiveRecordInterface ->count($con); } - return count($this->collOrderFeatures); + return count($this->collOrderProductAttributeCombinations); } /** - * Method called to associate a ChildOrderFeature object to this object - * through the ChildOrderFeature foreign key attribute. + * Method called to associate a ChildOrderProductAttributeCombination object to this object + * through the ChildOrderProductAttributeCombination foreign key attribute. * - * @param ChildOrderFeature $l ChildOrderFeature + * @param ChildOrderProductAttributeCombination $l ChildOrderProductAttributeCombination * @return \Thelia\Model\OrderProduct The current object (for fluent API support) */ - public function addOrderFeature(ChildOrderFeature $l) + public function addOrderProductAttributeCombination(ChildOrderProductAttributeCombination $l) { - if ($this->collOrderFeatures === null) { - $this->initOrderFeatures(); - $this->collOrderFeaturesPartial = true; + if ($this->collOrderProductAttributeCombinations === null) { + $this->initOrderProductAttributeCombinations(); + $this->collOrderProductAttributeCombinationsPartial = true; } - if (!in_array($l, $this->collOrderFeatures->getArrayCopy(), true)) { // only add it if the **same** object is not already associated - $this->doAddOrderFeature($l); + if (!in_array($l, $this->collOrderProductAttributeCombinations->getArrayCopy(), true)) { // only add it if the **same** object is not already associated + $this->doAddOrderProductAttributeCombination($l); } return $this; } /** - * @param OrderFeature $orderFeature The orderFeature object to add. + * @param OrderProductAttributeCombination $orderProductAttributeCombination The orderProductAttributeCombination object to add. */ - protected function doAddOrderFeature($orderFeature) + protected function doAddOrderProductAttributeCombination($orderProductAttributeCombination) { - $this->collOrderFeatures[]= $orderFeature; - $orderFeature->setOrderProduct($this); + $this->collOrderProductAttributeCombinations[]= $orderProductAttributeCombination; + $orderProductAttributeCombination->setOrderProduct($this); } /** - * @param OrderFeature $orderFeature The orderFeature object to remove. + * @param OrderProductAttributeCombination $orderProductAttributeCombination The orderProductAttributeCombination object to remove. * @return ChildOrderProduct The current object (for fluent API support) */ - public function removeOrderFeature($orderFeature) + public function removeOrderProductAttributeCombination($orderProductAttributeCombination) { - if ($this->getOrderFeatures()->contains($orderFeature)) { - $this->collOrderFeatures->remove($this->collOrderFeatures->search($orderFeature)); - if (null === $this->orderFeaturesScheduledForDeletion) { - $this->orderFeaturesScheduledForDeletion = clone $this->collOrderFeatures; - $this->orderFeaturesScheduledForDeletion->clear(); + if ($this->getOrderProductAttributeCombinations()->contains($orderProductAttributeCombination)) { + $this->collOrderProductAttributeCombinations->remove($this->collOrderProductAttributeCombinations->search($orderProductAttributeCombination)); + if (null === $this->orderProductAttributeCombinationsScheduledForDeletion) { + $this->orderProductAttributeCombinationsScheduledForDeletion = clone $this->collOrderProductAttributeCombinations; + $this->orderProductAttributeCombinationsScheduledForDeletion->clear(); } - $this->orderFeaturesScheduledForDeletion[]= clone $orderFeature; - $orderFeature->setOrderProduct(null); + $this->orderProductAttributeCombinationsScheduledForDeletion[]= clone $orderProductAttributeCombination; + $orderProductAttributeCombination->setOrderProduct(null); + } + + return $this; + } + + /** + * Clears out the collOrderProductTaxes collection + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addOrderProductTaxes() + */ + public function clearOrderProductTaxes() + { + $this->collOrderProductTaxes = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Reset is the collOrderProductTaxes collection loaded partially. + */ + public function resetPartialOrderProductTaxes($v = true) + { + $this->collOrderProductTaxesPartial = $v; + } + + /** + * Initializes the collOrderProductTaxes collection. + * + * By default this just sets the collOrderProductTaxes collection to an empty array (like clearcollOrderProductTaxes()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @param boolean $overrideExisting If set to true, the method call initializes + * the collection even if it is not empty + * + * @return void + */ + public function initOrderProductTaxes($overrideExisting = true) + { + if (null !== $this->collOrderProductTaxes && !$overrideExisting) { + return; + } + $this->collOrderProductTaxes = new ObjectCollection(); + $this->collOrderProductTaxes->setModel('\Thelia\Model\OrderProductTax'); + } + + /** + * Gets an array of ChildOrderProductTax objects which contain a foreign key that references this object. + * + * If the $criteria is not null, it is used to always fetch the results from the database. + * Otherwise the results are fetched from the database the first time, then cached. + * Next time the same method is called without $criteria, the cached collection is returned. + * If this ChildOrderProduct is new, it will return + * an empty collection or the current collection; the criteria is ignored on a new object. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @return Collection|ChildOrderProductTax[] List of ChildOrderProductTax objects + * @throws PropelException + */ + public function getOrderProductTaxes($criteria = null, ConnectionInterface $con = null) + { + $partial = $this->collOrderProductTaxesPartial && !$this->isNew(); + if (null === $this->collOrderProductTaxes || null !== $criteria || $partial) { + if ($this->isNew() && null === $this->collOrderProductTaxes) { + // return empty collection + $this->initOrderProductTaxes(); + } else { + $collOrderProductTaxes = ChildOrderProductTaxQuery::create(null, $criteria) + ->filterByOrderProduct($this) + ->find($con); + + if (null !== $criteria) { + if (false !== $this->collOrderProductTaxesPartial && count($collOrderProductTaxes)) { + $this->initOrderProductTaxes(false); + + foreach ($collOrderProductTaxes as $obj) { + if (false == $this->collOrderProductTaxes->contains($obj)) { + $this->collOrderProductTaxes->append($obj); + } + } + + $this->collOrderProductTaxesPartial = true; + } + + $collOrderProductTaxes->getInternalIterator()->rewind(); + + return $collOrderProductTaxes; + } + + if ($partial && $this->collOrderProductTaxes) { + foreach ($this->collOrderProductTaxes as $obj) { + if ($obj->isNew()) { + $collOrderProductTaxes[] = $obj; + } + } + } + + $this->collOrderProductTaxes = $collOrderProductTaxes; + $this->collOrderProductTaxesPartial = false; + } + } + + return $this->collOrderProductTaxes; + } + + /** + * Sets a collection of OrderProductTax objects related by a one-to-many relationship + * to the current object. + * It will also schedule objects for deletion based on a diff between old objects (aka persisted) + * and new objects from the given Propel collection. + * + * @param Collection $orderProductTaxes A Propel collection. + * @param ConnectionInterface $con Optional connection object + * @return ChildOrderProduct The current object (for fluent API support) + */ + public function setOrderProductTaxes(Collection $orderProductTaxes, ConnectionInterface $con = null) + { + $orderProductTaxesToDelete = $this->getOrderProductTaxes(new Criteria(), $con)->diff($orderProductTaxes); + + + $this->orderProductTaxesScheduledForDeletion = $orderProductTaxesToDelete; + + foreach ($orderProductTaxesToDelete as $orderProductTaxRemoved) { + $orderProductTaxRemoved->setOrderProduct(null); + } + + $this->collOrderProductTaxes = null; + foreach ($orderProductTaxes as $orderProductTax) { + $this->addOrderProductTax($orderProductTax); + } + + $this->collOrderProductTaxes = $orderProductTaxes; + $this->collOrderProductTaxesPartial = false; + + return $this; + } + + /** + * Returns the number of related OrderProductTax objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param ConnectionInterface $con + * @return int Count of related OrderProductTax objects. + * @throws PropelException + */ + public function countOrderProductTaxes(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) + { + $partial = $this->collOrderProductTaxesPartial && !$this->isNew(); + if (null === $this->collOrderProductTaxes || null !== $criteria || $partial) { + if ($this->isNew() && null === $this->collOrderProductTaxes) { + return 0; + } + + if ($partial && !$criteria) { + return count($this->getOrderProductTaxes()); + } + + $query = ChildOrderProductTaxQuery::create(null, $criteria); + if ($distinct) { + $query->distinct(); + } + + return $query + ->filterByOrderProduct($this) + ->count($con); + } + + return count($this->collOrderProductTaxes); + } + + /** + * Method called to associate a ChildOrderProductTax object to this object + * through the ChildOrderProductTax foreign key attribute. + * + * @param ChildOrderProductTax $l ChildOrderProductTax + * @return \Thelia\Model\OrderProduct The current object (for fluent API support) + */ + public function addOrderProductTax(ChildOrderProductTax $l) + { + if ($this->collOrderProductTaxes === null) { + $this->initOrderProductTaxes(); + $this->collOrderProductTaxesPartial = true; + } + + if (!in_array($l, $this->collOrderProductTaxes->getArrayCopy(), true)) { // only add it if the **same** object is not already associated + $this->doAddOrderProductTax($l); + } + + return $this; + } + + /** + * @param OrderProductTax $orderProductTax The orderProductTax object to add. + */ + protected function doAddOrderProductTax($orderProductTax) + { + $this->collOrderProductTaxes[]= $orderProductTax; + $orderProductTax->setOrderProduct($this); + } + + /** + * @param OrderProductTax $orderProductTax The orderProductTax object to remove. + * @return ChildOrderProduct The current object (for fluent API support) + */ + public function removeOrderProductTax($orderProductTax) + { + if ($this->getOrderProductTaxes()->contains($orderProductTax)) { + $this->collOrderProductTaxes->remove($this->collOrderProductTaxes->search($orderProductTax)); + if (null === $this->orderProductTaxesScheduledForDeletion) { + $this->orderProductTaxesScheduledForDeletion = clone $this->collOrderProductTaxes; + $this->orderProductTaxesScheduledForDeletion->clear(); + } + $this->orderProductTaxesScheduledForDeletion[]= clone $orderProductTax; + $orderProductTax->setOrderProduct(null); } return $this; @@ -1931,12 +2593,19 @@ abstract class OrderProduct implements ActiveRecordInterface $this->id = null; $this->order_id = null; $this->product_ref = null; + $this->product_sale_elements_ref = null; $this->title = null; - $this->description = null; $this->chapo = null; + $this->description = null; + $this->postscriptum = null; $this->quantity = null; $this->price = null; - $this->tax = null; + $this->promo_price = null; + $this->was_new = null; + $this->was_in_promo = null; + $this->weight = null; + $this->tax_rule_title = null; + $this->tax_rule_description = null; $this->parent = null; $this->created_at = null; $this->updated_at = null; @@ -1959,17 +2628,26 @@ abstract class OrderProduct implements ActiveRecordInterface public function clearAllReferences($deep = false) { if ($deep) { - if ($this->collOrderFeatures) { - foreach ($this->collOrderFeatures as $o) { + if ($this->collOrderProductAttributeCombinations) { + foreach ($this->collOrderProductAttributeCombinations as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collOrderProductTaxes) { + foreach ($this->collOrderProductTaxes as $o) { $o->clearAllReferences($deep); } } } // if ($deep) - if ($this->collOrderFeatures instanceof Collection) { - $this->collOrderFeatures->clearIterator(); + if ($this->collOrderProductAttributeCombinations instanceof Collection) { + $this->collOrderProductAttributeCombinations->clearIterator(); } - $this->collOrderFeatures = null; + $this->collOrderProductAttributeCombinations = null; + if ($this->collOrderProductTaxes instanceof Collection) { + $this->collOrderProductTaxes->clearIterator(); + } + $this->collOrderProductTaxes = null; $this->aOrder = null; } diff --git a/core/lib/Thelia/Model/Base/OrderProductQuery.php b/core/lib/Thelia/Model/Base/OrderProductQuery.php index b007c89e1..f28102dfb 100644 --- a/core/lib/Thelia/Model/Base/OrderProductQuery.php +++ b/core/lib/Thelia/Model/Base/OrderProductQuery.php @@ -24,12 +24,19 @@ use Thelia\Model\Map\OrderProductTableMap; * @method ChildOrderProductQuery orderById($order = Criteria::ASC) Order by the id column * @method ChildOrderProductQuery orderByOrderId($order = Criteria::ASC) Order by the order_id column * @method ChildOrderProductQuery orderByProductRef($order = Criteria::ASC) Order by the product_ref column + * @method ChildOrderProductQuery orderByProductSaleElementsRef($order = Criteria::ASC) Order by the product_sale_elements_ref column * @method ChildOrderProductQuery orderByTitle($order = Criteria::ASC) Order by the title column - * @method ChildOrderProductQuery orderByDescription($order = Criteria::ASC) Order by the description column * @method ChildOrderProductQuery orderByChapo($order = Criteria::ASC) Order by the chapo column + * @method ChildOrderProductQuery orderByDescription($order = Criteria::ASC) Order by the description column + * @method ChildOrderProductQuery orderByPostscriptum($order = Criteria::ASC) Order by the postscriptum column * @method ChildOrderProductQuery orderByQuantity($order = Criteria::ASC) Order by the quantity column * @method ChildOrderProductQuery orderByPrice($order = Criteria::ASC) Order by the price column - * @method ChildOrderProductQuery orderByTax($order = Criteria::ASC) Order by the tax column + * @method ChildOrderProductQuery orderByPromoPrice($order = Criteria::ASC) Order by the promo_price column + * @method ChildOrderProductQuery orderByWasNew($order = Criteria::ASC) Order by the was_new column + * @method ChildOrderProductQuery orderByWasInPromo($order = Criteria::ASC) Order by the was_in_promo column + * @method ChildOrderProductQuery orderByWeight($order = Criteria::ASC) Order by the weight column + * @method ChildOrderProductQuery orderByTaxRuleTitle($order = Criteria::ASC) Order by the tax_rule_title column + * @method ChildOrderProductQuery orderByTaxRuleDescription($order = Criteria::ASC) Order by the tax_rule_description column * @method ChildOrderProductQuery orderByParent($order = Criteria::ASC) Order by the parent column * @method ChildOrderProductQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column * @method ChildOrderProductQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column @@ -37,12 +44,19 @@ use Thelia\Model\Map\OrderProductTableMap; * @method ChildOrderProductQuery groupById() Group by the id column * @method ChildOrderProductQuery groupByOrderId() Group by the order_id column * @method ChildOrderProductQuery groupByProductRef() Group by the product_ref column + * @method ChildOrderProductQuery groupByProductSaleElementsRef() Group by the product_sale_elements_ref column * @method ChildOrderProductQuery groupByTitle() Group by the title column - * @method ChildOrderProductQuery groupByDescription() Group by the description column * @method ChildOrderProductQuery groupByChapo() Group by the chapo column + * @method ChildOrderProductQuery groupByDescription() Group by the description column + * @method ChildOrderProductQuery groupByPostscriptum() Group by the postscriptum column * @method ChildOrderProductQuery groupByQuantity() Group by the quantity column * @method ChildOrderProductQuery groupByPrice() Group by the price column - * @method ChildOrderProductQuery groupByTax() Group by the tax column + * @method ChildOrderProductQuery groupByPromoPrice() Group by the promo_price column + * @method ChildOrderProductQuery groupByWasNew() Group by the was_new column + * @method ChildOrderProductQuery groupByWasInPromo() Group by the was_in_promo column + * @method ChildOrderProductQuery groupByWeight() Group by the weight column + * @method ChildOrderProductQuery groupByTaxRuleTitle() Group by the tax_rule_title column + * @method ChildOrderProductQuery groupByTaxRuleDescription() Group by the tax_rule_description column * @method ChildOrderProductQuery groupByParent() Group by the parent column * @method ChildOrderProductQuery groupByCreatedAt() Group by the created_at column * @method ChildOrderProductQuery groupByUpdatedAt() Group by the updated_at column @@ -55,9 +69,13 @@ use Thelia\Model\Map\OrderProductTableMap; * @method ChildOrderProductQuery rightJoinOrder($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Order relation * @method ChildOrderProductQuery innerJoinOrder($relationAlias = null) Adds a INNER JOIN clause to the query using the Order relation * - * @method ChildOrderProductQuery leftJoinOrderFeature($relationAlias = null) Adds a LEFT JOIN clause to the query using the OrderFeature relation - * @method ChildOrderProductQuery rightJoinOrderFeature($relationAlias = null) Adds a RIGHT JOIN clause to the query using the OrderFeature relation - * @method ChildOrderProductQuery innerJoinOrderFeature($relationAlias = null) Adds a INNER JOIN clause to the query using the OrderFeature relation + * @method ChildOrderProductQuery leftJoinOrderProductAttributeCombination($relationAlias = null) Adds a LEFT JOIN clause to the query using the OrderProductAttributeCombination relation + * @method ChildOrderProductQuery rightJoinOrderProductAttributeCombination($relationAlias = null) Adds a RIGHT JOIN clause to the query using the OrderProductAttributeCombination relation + * @method ChildOrderProductQuery innerJoinOrderProductAttributeCombination($relationAlias = null) Adds a INNER JOIN clause to the query using the OrderProductAttributeCombination relation + * + * @method ChildOrderProductQuery leftJoinOrderProductTax($relationAlias = null) Adds a LEFT JOIN clause to the query using the OrderProductTax relation + * @method ChildOrderProductQuery rightJoinOrderProductTax($relationAlias = null) Adds a RIGHT JOIN clause to the query using the OrderProductTax relation + * @method ChildOrderProductQuery innerJoinOrderProductTax($relationAlias = null) Adds a INNER JOIN clause to the query using the OrderProductTax relation * * @method ChildOrderProduct findOne(ConnectionInterface $con = null) Return the first ChildOrderProduct matching the query * @method ChildOrderProduct findOneOrCreate(ConnectionInterface $con = null) Return the first ChildOrderProduct matching the query, or a new ChildOrderProduct object populated from the query conditions when no match is found @@ -65,12 +83,19 @@ use Thelia\Model\Map\OrderProductTableMap; * @method ChildOrderProduct findOneById(int $id) Return the first ChildOrderProduct filtered by the id column * @method ChildOrderProduct findOneByOrderId(int $order_id) Return the first ChildOrderProduct filtered by the order_id column * @method ChildOrderProduct findOneByProductRef(string $product_ref) Return the first ChildOrderProduct filtered by the product_ref column + * @method ChildOrderProduct findOneByProductSaleElementsRef(string $product_sale_elements_ref) Return the first ChildOrderProduct filtered by the product_sale_elements_ref column * @method ChildOrderProduct findOneByTitle(string $title) Return the first ChildOrderProduct filtered by the title column - * @method ChildOrderProduct findOneByDescription(string $description) Return the first ChildOrderProduct filtered by the description column * @method ChildOrderProduct findOneByChapo(string $chapo) Return the first ChildOrderProduct filtered by the chapo column + * @method ChildOrderProduct findOneByDescription(string $description) Return the first ChildOrderProduct filtered by the description column + * @method ChildOrderProduct findOneByPostscriptum(string $postscriptum) Return the first ChildOrderProduct filtered by the postscriptum column * @method ChildOrderProduct findOneByQuantity(double $quantity) Return the first ChildOrderProduct filtered by the quantity column * @method ChildOrderProduct findOneByPrice(double $price) Return the first ChildOrderProduct filtered by the price column - * @method ChildOrderProduct findOneByTax(double $tax) Return the first ChildOrderProduct filtered by the tax column + * @method ChildOrderProduct findOneByPromoPrice(string $promo_price) Return the first ChildOrderProduct filtered by the promo_price column + * @method ChildOrderProduct findOneByWasNew(int $was_new) Return the first ChildOrderProduct filtered by the was_new column + * @method ChildOrderProduct findOneByWasInPromo(int $was_in_promo) Return the first ChildOrderProduct filtered by the was_in_promo column + * @method ChildOrderProduct findOneByWeight(string $weight) Return the first ChildOrderProduct filtered by the weight column + * @method ChildOrderProduct findOneByTaxRuleTitle(string $tax_rule_title) Return the first ChildOrderProduct filtered by the tax_rule_title column + * @method ChildOrderProduct findOneByTaxRuleDescription(string $tax_rule_description) Return the first ChildOrderProduct filtered by the tax_rule_description column * @method ChildOrderProduct findOneByParent(int $parent) Return the first ChildOrderProduct filtered by the parent column * @method ChildOrderProduct findOneByCreatedAt(string $created_at) Return the first ChildOrderProduct filtered by the created_at column * @method ChildOrderProduct findOneByUpdatedAt(string $updated_at) Return the first ChildOrderProduct filtered by the updated_at column @@ -78,12 +103,19 @@ use Thelia\Model\Map\OrderProductTableMap; * @method array findById(int $id) Return ChildOrderProduct objects filtered by the id column * @method array findByOrderId(int $order_id) Return ChildOrderProduct objects filtered by the order_id column * @method array findByProductRef(string $product_ref) Return ChildOrderProduct objects filtered by the product_ref column + * @method array findByProductSaleElementsRef(string $product_sale_elements_ref) Return ChildOrderProduct objects filtered by the product_sale_elements_ref column * @method array findByTitle(string $title) Return ChildOrderProduct objects filtered by the title column - * @method array findByDescription(string $description) Return ChildOrderProduct objects filtered by the description column * @method array findByChapo(string $chapo) Return ChildOrderProduct objects filtered by the chapo column + * @method array findByDescription(string $description) Return ChildOrderProduct objects filtered by the description column + * @method array findByPostscriptum(string $postscriptum) Return ChildOrderProduct objects filtered by the postscriptum column * @method array findByQuantity(double $quantity) Return ChildOrderProduct objects filtered by the quantity column * @method array findByPrice(double $price) Return ChildOrderProduct objects filtered by the price column - * @method array findByTax(double $tax) Return ChildOrderProduct objects filtered by the tax column + * @method array findByPromoPrice(string $promo_price) Return ChildOrderProduct objects filtered by the promo_price column + * @method array findByWasNew(int $was_new) Return ChildOrderProduct objects filtered by the was_new column + * @method array findByWasInPromo(int $was_in_promo) Return ChildOrderProduct objects filtered by the was_in_promo column + * @method array findByWeight(string $weight) Return ChildOrderProduct objects filtered by the weight column + * @method array findByTaxRuleTitle(string $tax_rule_title) Return ChildOrderProduct objects filtered by the tax_rule_title column + * @method array findByTaxRuleDescription(string $tax_rule_description) Return ChildOrderProduct objects filtered by the tax_rule_description column * @method array findByParent(int $parent) Return ChildOrderProduct objects filtered by the parent column * @method array findByCreatedAt(string $created_at) Return ChildOrderProduct objects filtered by the created_at column * @method array findByUpdatedAt(string $updated_at) Return ChildOrderProduct objects filtered by the updated_at column @@ -175,7 +207,7 @@ abstract class OrderProductQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, ORDER_ID, PRODUCT_REF, TITLE, DESCRIPTION, CHAPO, QUANTITY, PRICE, TAX, PARENT, CREATED_AT, UPDATED_AT FROM order_product WHERE ID = :p0'; + $sql = 'SELECT ID, ORDER_ID, PRODUCT_REF, PRODUCT_SALE_ELEMENTS_REF, TITLE, CHAPO, DESCRIPTION, POSTSCRIPTUM, QUANTITY, PRICE, PROMO_PRICE, WAS_NEW, WAS_IN_PROMO, WEIGHT, TAX_RULE_TITLE, TAX_RULE_DESCRIPTION, PARENT, CREATED_AT, UPDATED_AT FROM order_product WHERE ID = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); @@ -377,6 +409,35 @@ abstract class OrderProductQuery extends ModelCriteria return $this->addUsingAlias(OrderProductTableMap::PRODUCT_REF, $productRef, $comparison); } + /** + * Filter the query on the product_sale_elements_ref column + * + * Example usage: + * + * $query->filterByProductSaleElementsRef('fooValue'); // WHERE product_sale_elements_ref = 'fooValue' + * $query->filterByProductSaleElementsRef('%fooValue%'); // WHERE product_sale_elements_ref LIKE '%fooValue%' + * + * + * @param string $productSaleElementsRef The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildOrderProductQuery The current query, for fluid interface + */ + public function filterByProductSaleElementsRef($productSaleElementsRef = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($productSaleElementsRef)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $productSaleElementsRef)) { + $productSaleElementsRef = str_replace('*', '%', $productSaleElementsRef); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(OrderProductTableMap::PRODUCT_SALE_ELEMENTS_REF, $productSaleElementsRef, $comparison); + } + /** * Filter the query on the title column * @@ -406,6 +467,35 @@ abstract class OrderProductQuery extends ModelCriteria return $this->addUsingAlias(OrderProductTableMap::TITLE, $title, $comparison); } + /** + * Filter the query on the chapo column + * + * Example usage: + * + * $query->filterByChapo('fooValue'); // WHERE chapo = 'fooValue' + * $query->filterByChapo('%fooValue%'); // WHERE chapo LIKE '%fooValue%' + * + * + * @param string $chapo The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildOrderProductQuery The current query, for fluid interface + */ + public function filterByChapo($chapo = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($chapo)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $chapo)) { + $chapo = str_replace('*', '%', $chapo); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(OrderProductTableMap::CHAPO, $chapo, $comparison); + } + /** * Filter the query on the description column * @@ -436,32 +526,32 @@ abstract class OrderProductQuery extends ModelCriteria } /** - * Filter the query on the chapo column + * Filter the query on the postscriptum column * * Example usage: * - * $query->filterByChapo('fooValue'); // WHERE chapo = 'fooValue' - * $query->filterByChapo('%fooValue%'); // WHERE chapo LIKE '%fooValue%' + * $query->filterByPostscriptum('fooValue'); // WHERE postscriptum = 'fooValue' + * $query->filterByPostscriptum('%fooValue%'); // WHERE postscriptum LIKE '%fooValue%' * * - * @param string $chapo The value to use as filter. + * @param string $postscriptum The value to use as filter. * Accepts wildcards (* and % trigger a LIKE) * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return ChildOrderProductQuery The current query, for fluid interface */ - public function filterByChapo($chapo = null, $comparison = null) + public function filterByPostscriptum($postscriptum = null, $comparison = null) { if (null === $comparison) { - if (is_array($chapo)) { + if (is_array($postscriptum)) { $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $chapo)) { - $chapo = str_replace('*', '%', $chapo); + } elseif (preg_match('/[\%\*]/', $postscriptum)) { + $postscriptum = str_replace('*', '%', $postscriptum); $comparison = Criteria::LIKE; } } - return $this->addUsingAlias(OrderProductTableMap::CHAPO, $chapo, $comparison); + return $this->addUsingAlias(OrderProductTableMap::POSTSCRIPTUM, $postscriptum, $comparison); } /** @@ -547,16 +637,45 @@ abstract class OrderProductQuery extends ModelCriteria } /** - * Filter the query on the tax column + * Filter the query on the promo_price column * * Example usage: * - * $query->filterByTax(1234); // WHERE tax = 1234 - * $query->filterByTax(array(12, 34)); // WHERE tax IN (12, 34) - * $query->filterByTax(array('min' => 12)); // WHERE tax > 12 + * $query->filterByPromoPrice('fooValue'); // WHERE promo_price = 'fooValue' + * $query->filterByPromoPrice('%fooValue%'); // WHERE promo_price LIKE '%fooValue%' * * - * @param mixed $tax The value to use as filter. + * @param string $promoPrice The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildOrderProductQuery The current query, for fluid interface + */ + public function filterByPromoPrice($promoPrice = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($promoPrice)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $promoPrice)) { + $promoPrice = str_replace('*', '%', $promoPrice); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(OrderProductTableMap::PROMO_PRICE, $promoPrice, $comparison); + } + + /** + * Filter the query on the was_new column + * + * Example usage: + * + * $query->filterByWasNew(1234); // WHERE was_new = 1234 + * $query->filterByWasNew(array(12, 34)); // WHERE was_new IN (12, 34) + * $query->filterByWasNew(array('min' => 12)); // WHERE was_new > 12 + * + * + * @param mixed $wasNew The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. @@ -564,16 +683,16 @@ abstract class OrderProductQuery extends ModelCriteria * * @return ChildOrderProductQuery The current query, for fluid interface */ - public function filterByTax($tax = null, $comparison = null) + public function filterByWasNew($wasNew = null, $comparison = null) { - if (is_array($tax)) { + if (is_array($wasNew)) { $useMinMax = false; - if (isset($tax['min'])) { - $this->addUsingAlias(OrderProductTableMap::TAX, $tax['min'], Criteria::GREATER_EQUAL); + if (isset($wasNew['min'])) { + $this->addUsingAlias(OrderProductTableMap::WAS_NEW, $wasNew['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } - if (isset($tax['max'])) { - $this->addUsingAlias(OrderProductTableMap::TAX, $tax['max'], Criteria::LESS_EQUAL); + if (isset($wasNew['max'])) { + $this->addUsingAlias(OrderProductTableMap::WAS_NEW, $wasNew['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { @@ -584,7 +703,135 @@ abstract class OrderProductQuery extends ModelCriteria } } - return $this->addUsingAlias(OrderProductTableMap::TAX, $tax, $comparison); + return $this->addUsingAlias(OrderProductTableMap::WAS_NEW, $wasNew, $comparison); + } + + /** + * Filter the query on the was_in_promo column + * + * Example usage: + * + * $query->filterByWasInPromo(1234); // WHERE was_in_promo = 1234 + * $query->filterByWasInPromo(array(12, 34)); // WHERE was_in_promo IN (12, 34) + * $query->filterByWasInPromo(array('min' => 12)); // WHERE was_in_promo > 12 + * + * + * @param mixed $wasInPromo The value to use as filter. + * Use scalar values for equality. + * Use array values for in_array() equivalent. + * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildOrderProductQuery The current query, for fluid interface + */ + public function filterByWasInPromo($wasInPromo = null, $comparison = null) + { + if (is_array($wasInPromo)) { + $useMinMax = false; + if (isset($wasInPromo['min'])) { + $this->addUsingAlias(OrderProductTableMap::WAS_IN_PROMO, $wasInPromo['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($wasInPromo['max'])) { + $this->addUsingAlias(OrderProductTableMap::WAS_IN_PROMO, $wasInPromo['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(OrderProductTableMap::WAS_IN_PROMO, $wasInPromo, $comparison); + } + + /** + * Filter the query on the weight column + * + * Example usage: + * + * $query->filterByWeight('fooValue'); // WHERE weight = 'fooValue' + * $query->filterByWeight('%fooValue%'); // WHERE weight LIKE '%fooValue%' + * + * + * @param string $weight The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildOrderProductQuery The current query, for fluid interface + */ + public function filterByWeight($weight = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($weight)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $weight)) { + $weight = str_replace('*', '%', $weight); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(OrderProductTableMap::WEIGHT, $weight, $comparison); + } + + /** + * Filter the query on the tax_rule_title column + * + * Example usage: + * + * $query->filterByTaxRuleTitle('fooValue'); // WHERE tax_rule_title = 'fooValue' + * $query->filterByTaxRuleTitle('%fooValue%'); // WHERE tax_rule_title LIKE '%fooValue%' + * + * + * @param string $taxRuleTitle The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildOrderProductQuery The current query, for fluid interface + */ + public function filterByTaxRuleTitle($taxRuleTitle = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($taxRuleTitle)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $taxRuleTitle)) { + $taxRuleTitle = str_replace('*', '%', $taxRuleTitle); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(OrderProductTableMap::TAX_RULE_TITLE, $taxRuleTitle, $comparison); + } + + /** + * Filter the query on the tax_rule_description column + * + * Example usage: + * + * $query->filterByTaxRuleDescription('fooValue'); // WHERE tax_rule_description = 'fooValue' + * $query->filterByTaxRuleDescription('%fooValue%'); // WHERE tax_rule_description LIKE '%fooValue%' + * + * + * @param string $taxRuleDescription The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildOrderProductQuery The current query, for fluid interface + */ + public function filterByTaxRuleDescription($taxRuleDescription = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($taxRuleDescription)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $taxRuleDescription)) { + $taxRuleDescription = str_replace('*', '%', $taxRuleDescription); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(OrderProductTableMap::TAX_RULE_DESCRIPTION, $taxRuleDescription, $comparison); } /** @@ -790,40 +1037,40 @@ abstract class OrderProductQuery extends ModelCriteria } /** - * Filter the query by a related \Thelia\Model\OrderFeature object + * Filter the query by a related \Thelia\Model\OrderProductAttributeCombination object * - * @param \Thelia\Model\OrderFeature|ObjectCollection $orderFeature the related object to use as filter + * @param \Thelia\Model\OrderProductAttributeCombination|ObjectCollection $orderProductAttributeCombination the related object to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return ChildOrderProductQuery The current query, for fluid interface */ - public function filterByOrderFeature($orderFeature, $comparison = null) + public function filterByOrderProductAttributeCombination($orderProductAttributeCombination, $comparison = null) { - if ($orderFeature instanceof \Thelia\Model\OrderFeature) { + if ($orderProductAttributeCombination instanceof \Thelia\Model\OrderProductAttributeCombination) { return $this - ->addUsingAlias(OrderProductTableMap::ID, $orderFeature->getOrderProductId(), $comparison); - } elseif ($orderFeature instanceof ObjectCollection) { + ->addUsingAlias(OrderProductTableMap::ID, $orderProductAttributeCombination->getOrderProductId(), $comparison); + } elseif ($orderProductAttributeCombination instanceof ObjectCollection) { return $this - ->useOrderFeatureQuery() - ->filterByPrimaryKeys($orderFeature->getPrimaryKeys()) + ->useOrderProductAttributeCombinationQuery() + ->filterByPrimaryKeys($orderProductAttributeCombination->getPrimaryKeys()) ->endUse(); } else { - throw new PropelException('filterByOrderFeature() only accepts arguments of type \Thelia\Model\OrderFeature or Collection'); + throw new PropelException('filterByOrderProductAttributeCombination() only accepts arguments of type \Thelia\Model\OrderProductAttributeCombination or Collection'); } } /** - * Adds a JOIN clause to the query using the OrderFeature relation + * Adds a JOIN clause to the query using the OrderProductAttributeCombination relation * * @param string $relationAlias optional alias for the relation * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return ChildOrderProductQuery The current query, for fluid interface */ - public function joinOrderFeature($relationAlias = null, $joinType = Criteria::INNER_JOIN) + public function joinOrderProductAttributeCombination($relationAlias = null, $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('OrderFeature'); + $relationMap = $tableMap->getRelation('OrderProductAttributeCombination'); // create a ModelJoin object for this join $join = new ModelJoin(); @@ -838,14 +1085,14 @@ abstract class OrderProductQuery extends ModelCriteria $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); $this->addJoinObject($join, $relationAlias); } else { - $this->addJoinObject($join, 'OrderFeature'); + $this->addJoinObject($join, 'OrderProductAttributeCombination'); } return $this; } /** - * Use the OrderFeature relation OrderFeature object + * Use the OrderProductAttributeCombination relation OrderProductAttributeCombination object * * @see useQuery() * @@ -853,13 +1100,86 @@ abstract class OrderProductQuery extends ModelCriteria * to be used as main alias in the secondary query * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return \Thelia\Model\OrderFeatureQuery A secondary query class using the current class as primary query + * @return \Thelia\Model\OrderProductAttributeCombinationQuery A secondary query class using the current class as primary query */ - public function useOrderFeatureQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) + public function useOrderProductAttributeCombinationQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) { return $this - ->joinOrderFeature($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'OrderFeature', '\Thelia\Model\OrderFeatureQuery'); + ->joinOrderProductAttributeCombination($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'OrderProductAttributeCombination', '\Thelia\Model\OrderProductAttributeCombinationQuery'); + } + + /** + * Filter the query by a related \Thelia\Model\OrderProductTax object + * + * @param \Thelia\Model\OrderProductTax|ObjectCollection $orderProductTax the related object to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildOrderProductQuery The current query, for fluid interface + */ + public function filterByOrderProductTax($orderProductTax, $comparison = null) + { + if ($orderProductTax instanceof \Thelia\Model\OrderProductTax) { + return $this + ->addUsingAlias(OrderProductTableMap::ID, $orderProductTax->getOrderProductId(), $comparison); + } elseif ($orderProductTax instanceof ObjectCollection) { + return $this + ->useOrderProductTaxQuery() + ->filterByPrimaryKeys($orderProductTax->getPrimaryKeys()) + ->endUse(); + } else { + throw new PropelException('filterByOrderProductTax() only accepts arguments of type \Thelia\Model\OrderProductTax or Collection'); + } + } + + /** + * Adds a JOIN clause to the query using the OrderProductTax relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return ChildOrderProductQuery The current query, for fluid interface + */ + public function joinOrderProductTax($relationAlias = null, $joinType = Criteria::INNER_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('OrderProductTax'); + + // create a ModelJoin object for this join + $join = new ModelJoin(); + $join->setJoinType($joinType); + $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); + if ($previousJoin = $this->getPreviousJoin()) { + $join->setPreviousJoin($previousJoin); + } + + // add the ModelJoin to the current object + if ($relationAlias) { + $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); + $this->addJoinObject($join, $relationAlias); + } else { + $this->addJoinObject($join, 'OrderProductTax'); + } + + return $this; + } + + /** + * Use the OrderProductTax relation OrderProductTax object + * + * @see useQuery() + * + * @param string $relationAlias optional alias for the relation, + * to be used as main alias in the secondary query + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return \Thelia\Model\OrderProductTaxQuery A secondary query class using the current class as primary query + */ + public function useOrderProductTaxQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) + { + return $this + ->joinOrderProductTax($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'OrderProductTax', '\Thelia\Model\OrderProductTaxQuery'); } /** diff --git a/core/lib/Thelia/Model/FeatureProduct.php b/core/lib/Thelia/Model/FeatureProduct.php index 35a9b2ddc..fe6c5d8c1 100755 --- a/core/lib/Thelia/Model/FeatureProduct.php +++ b/core/lib/Thelia/Model/FeatureProduct.php @@ -3,8 +3,66 @@ namespace Thelia\Model; use Thelia\Model\Base\FeatureProduct as BaseFeatureProduct; +use Thelia\Core\Event\TheliaEvents; +use Propel\Runtime\Connection\ConnectionInterface; +use Thelia\Core\Event\FeatureProductEvent; - class FeatureProduct extends BaseFeatureProduct +class FeatureProduct extends BaseFeatureProduct { + use \Thelia\Model\Tools\ModelEventDispatcherTrait; + + /** + * {@inheritDoc} + */ + public function preInsert(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::BEFORE_CREATEFEATURE_PRODUCT, new FeatureProductEvent($this)); + + return true; + } + + /** + * {@inheritDoc} + */ + public function postInsert(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::AFTER_CREATEFEATURE_PRODUCT, new FeatureProductEvent($this)); + } + + /** + * {@inheritDoc} + */ + public function preUpdate(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::BEFORE_UPDATEFEATURE_PRODUCT, new FeatureProductEvent($this)); + + return true; + } + + /** + * {@inheritDoc} + */ + public function postUpdate(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::AFTER_UPDATEFEATURE_PRODUCT, new FeatureProductEvent($this)); + } + + /** + * {@inheritDoc} + */ + public function preDelete(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::BEFORE_DELETEFEATURE_PRODUCT, new FeatureProductEvent($this)); + + return true; + } + + /** + * {@inheritDoc} + */ + public function postDelete(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::AFTER_DELETEFEATURE_PRODUCT, new FeatureProductEvent($this)); + } } diff --git a/core/lib/Thelia/Model/Map/AttributeCombinationTableMap.php b/core/lib/Thelia/Model/Map/AttributeCombinationTableMap.php index c13b85bbf..031ecfd81 100644 --- a/core/lib/Thelia/Model/Map/AttributeCombinationTableMap.php +++ b/core/lib/Thelia/Model/Map/AttributeCombinationTableMap.php @@ -57,7 +57,7 @@ class AttributeCombinationTableMap extends TableMap /** * The total number of columns */ - const NUM_COLUMNS = 5; + const NUM_COLUMNS = 6; /** * The number of lazy-loaded columns @@ -67,7 +67,7 @@ class AttributeCombinationTableMap extends TableMap /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 5; + const NUM_HYDRATE_COLUMNS = 6; /** * the column name for the ATTRIBUTE_ID field @@ -84,6 +84,11 @@ class AttributeCombinationTableMap extends TableMap */ const PRODUCT_SALE_ELEMENTS_ID = 'attribute_combination.PRODUCT_SALE_ELEMENTS_ID'; + /** + * the column name for the IS_DEFAULT field + */ + const IS_DEFAULT = 'attribute_combination.IS_DEFAULT'; + /** * the column name for the CREATED_AT field */ @@ -106,12 +111,12 @@ class AttributeCombinationTableMap extends TableMap * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ protected static $fieldNames = array ( - self::TYPE_PHPNAME => array('AttributeId', 'AttributeAvId', 'ProductSaleElementsId', 'CreatedAt', 'UpdatedAt', ), - self::TYPE_STUDLYPHPNAME => array('attributeId', 'attributeAvId', 'productSaleElementsId', 'createdAt', 'updatedAt', ), - self::TYPE_COLNAME => array(AttributeCombinationTableMap::ATTRIBUTE_ID, AttributeCombinationTableMap::ATTRIBUTE_AV_ID, AttributeCombinationTableMap::PRODUCT_SALE_ELEMENTS_ID, AttributeCombinationTableMap::CREATED_AT, AttributeCombinationTableMap::UPDATED_AT, ), - self::TYPE_RAW_COLNAME => array('ATTRIBUTE_ID', 'ATTRIBUTE_AV_ID', 'PRODUCT_SALE_ELEMENTS_ID', 'CREATED_AT', 'UPDATED_AT', ), - self::TYPE_FIELDNAME => array('attribute_id', 'attribute_av_id', 'product_sale_elements_id', 'created_at', 'updated_at', ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, ) + self::TYPE_PHPNAME => array('AttributeId', 'AttributeAvId', 'ProductSaleElementsId', 'IsDefault', 'CreatedAt', 'UpdatedAt', ), + self::TYPE_STUDLYPHPNAME => array('attributeId', 'attributeAvId', 'productSaleElementsId', 'isDefault', 'createdAt', 'updatedAt', ), + self::TYPE_COLNAME => array(AttributeCombinationTableMap::ATTRIBUTE_ID, AttributeCombinationTableMap::ATTRIBUTE_AV_ID, AttributeCombinationTableMap::PRODUCT_SALE_ELEMENTS_ID, AttributeCombinationTableMap::IS_DEFAULT, AttributeCombinationTableMap::CREATED_AT, AttributeCombinationTableMap::UPDATED_AT, ), + self::TYPE_RAW_COLNAME => array('ATTRIBUTE_ID', 'ATTRIBUTE_AV_ID', 'PRODUCT_SALE_ELEMENTS_ID', 'IS_DEFAULT', 'CREATED_AT', 'UPDATED_AT', ), + self::TYPE_FIELDNAME => array('attribute_id', 'attribute_av_id', 'product_sale_elements_id', 'is_default', 'created_at', 'updated_at', ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, ) ); /** @@ -121,12 +126,12 @@ class AttributeCombinationTableMap extends TableMap * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 */ protected static $fieldKeys = array ( - self::TYPE_PHPNAME => array('AttributeId' => 0, 'AttributeAvId' => 1, 'ProductSaleElementsId' => 2, 'CreatedAt' => 3, 'UpdatedAt' => 4, ), - self::TYPE_STUDLYPHPNAME => array('attributeId' => 0, 'attributeAvId' => 1, 'productSaleElementsId' => 2, 'createdAt' => 3, 'updatedAt' => 4, ), - self::TYPE_COLNAME => array(AttributeCombinationTableMap::ATTRIBUTE_ID => 0, AttributeCombinationTableMap::ATTRIBUTE_AV_ID => 1, AttributeCombinationTableMap::PRODUCT_SALE_ELEMENTS_ID => 2, AttributeCombinationTableMap::CREATED_AT => 3, AttributeCombinationTableMap::UPDATED_AT => 4, ), - self::TYPE_RAW_COLNAME => array('ATTRIBUTE_ID' => 0, 'ATTRIBUTE_AV_ID' => 1, 'PRODUCT_SALE_ELEMENTS_ID' => 2, 'CREATED_AT' => 3, 'UPDATED_AT' => 4, ), - self::TYPE_FIELDNAME => array('attribute_id' => 0, 'attribute_av_id' => 1, 'product_sale_elements_id' => 2, 'created_at' => 3, 'updated_at' => 4, ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, ) + self::TYPE_PHPNAME => array('AttributeId' => 0, 'AttributeAvId' => 1, 'ProductSaleElementsId' => 2, 'IsDefault' => 3, 'CreatedAt' => 4, 'UpdatedAt' => 5, ), + self::TYPE_STUDLYPHPNAME => array('attributeId' => 0, 'attributeAvId' => 1, 'productSaleElementsId' => 2, 'isDefault' => 3, 'createdAt' => 4, 'updatedAt' => 5, ), + self::TYPE_COLNAME => array(AttributeCombinationTableMap::ATTRIBUTE_ID => 0, AttributeCombinationTableMap::ATTRIBUTE_AV_ID => 1, AttributeCombinationTableMap::PRODUCT_SALE_ELEMENTS_ID => 2, AttributeCombinationTableMap::IS_DEFAULT => 3, AttributeCombinationTableMap::CREATED_AT => 4, AttributeCombinationTableMap::UPDATED_AT => 5, ), + self::TYPE_RAW_COLNAME => array('ATTRIBUTE_ID' => 0, 'ATTRIBUTE_AV_ID' => 1, 'PRODUCT_SALE_ELEMENTS_ID' => 2, 'IS_DEFAULT' => 3, 'CREATED_AT' => 4, 'UPDATED_AT' => 5, ), + self::TYPE_FIELDNAME => array('attribute_id' => 0, 'attribute_av_id' => 1, 'product_sale_elements_id' => 2, 'is_default' => 3, 'created_at' => 4, 'updated_at' => 5, ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, ) ); /** @@ -148,6 +153,7 @@ class AttributeCombinationTableMap extends TableMap $this->addForeignPrimaryKey('ATTRIBUTE_ID', 'AttributeId', 'INTEGER' , 'attribute', 'ID', true, null, null); $this->addForeignPrimaryKey('ATTRIBUTE_AV_ID', 'AttributeAvId', 'INTEGER' , 'attribute_av', 'ID', true, null, null); $this->addForeignPrimaryKey('PRODUCT_SALE_ELEMENTS_ID', 'ProductSaleElementsId', 'INTEGER' , 'product_sale_elements', 'ID', true, null, null); + $this->addColumn('IS_DEFAULT', 'IsDefault', 'BOOLEAN', false, 1, false); $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null); $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null); } // initialize() @@ -365,12 +371,14 @@ class AttributeCombinationTableMap extends TableMap $criteria->addSelectColumn(AttributeCombinationTableMap::ATTRIBUTE_ID); $criteria->addSelectColumn(AttributeCombinationTableMap::ATTRIBUTE_AV_ID); $criteria->addSelectColumn(AttributeCombinationTableMap::PRODUCT_SALE_ELEMENTS_ID); + $criteria->addSelectColumn(AttributeCombinationTableMap::IS_DEFAULT); $criteria->addSelectColumn(AttributeCombinationTableMap::CREATED_AT); $criteria->addSelectColumn(AttributeCombinationTableMap::UPDATED_AT); } else { $criteria->addSelectColumn($alias . '.ATTRIBUTE_ID'); $criteria->addSelectColumn($alias . '.ATTRIBUTE_AV_ID'); $criteria->addSelectColumn($alias . '.PRODUCT_SALE_ELEMENTS_ID'); + $criteria->addSelectColumn($alias . '.IS_DEFAULT'); $criteria->addSelectColumn($alias . '.CREATED_AT'); $criteria->addSelectColumn($alias . '.UPDATED_AT'); } diff --git a/core/lib/Thelia/Model/Map/FeatureProductTableMap.php b/core/lib/Thelia/Model/Map/FeatureProductTableMap.php index f0263b47c..9db4ec441 100644 --- a/core/lib/Thelia/Model/Map/FeatureProductTableMap.php +++ b/core/lib/Thelia/Model/Map/FeatureProductTableMap.php @@ -90,9 +90,9 @@ class FeatureProductTableMap extends TableMap const FEATURE_AV_ID = 'feature_product.FEATURE_AV_ID'; /** - * the column name for the BY_DEFAULT field + * the column name for the FREE_TEXT_VALUE field */ - const BY_DEFAULT = 'feature_product.BY_DEFAULT'; + const FREE_TEXT_VALUE = 'feature_product.FREE_TEXT_VALUE'; /** * the column name for the POSITION field @@ -121,11 +121,11 @@ class FeatureProductTableMap extends TableMap * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ protected static $fieldNames = array ( - self::TYPE_PHPNAME => array('Id', 'ProductId', 'FeatureId', 'FeatureAvId', 'ByDefault', 'Position', 'CreatedAt', 'UpdatedAt', ), - self::TYPE_STUDLYPHPNAME => array('id', 'productId', 'featureId', 'featureAvId', 'byDefault', 'position', 'createdAt', 'updatedAt', ), - self::TYPE_COLNAME => array(FeatureProductTableMap::ID, FeatureProductTableMap::PRODUCT_ID, FeatureProductTableMap::FEATURE_ID, FeatureProductTableMap::FEATURE_AV_ID, FeatureProductTableMap::BY_DEFAULT, FeatureProductTableMap::POSITION, FeatureProductTableMap::CREATED_AT, FeatureProductTableMap::UPDATED_AT, ), - self::TYPE_RAW_COLNAME => array('ID', 'PRODUCT_ID', 'FEATURE_ID', 'FEATURE_AV_ID', 'BY_DEFAULT', 'POSITION', 'CREATED_AT', 'UPDATED_AT', ), - self::TYPE_FIELDNAME => array('id', 'product_id', 'feature_id', 'feature_av_id', 'by_default', 'position', 'created_at', 'updated_at', ), + self::TYPE_PHPNAME => array('Id', 'ProductId', 'FeatureId', 'FeatureAvId', 'FreeTextValue', 'Position', 'CreatedAt', 'UpdatedAt', ), + self::TYPE_STUDLYPHPNAME => array('id', 'productId', 'featureId', 'featureAvId', 'freeTextValue', 'position', 'createdAt', 'updatedAt', ), + self::TYPE_COLNAME => array(FeatureProductTableMap::ID, FeatureProductTableMap::PRODUCT_ID, FeatureProductTableMap::FEATURE_ID, FeatureProductTableMap::FEATURE_AV_ID, FeatureProductTableMap::FREE_TEXT_VALUE, FeatureProductTableMap::POSITION, FeatureProductTableMap::CREATED_AT, FeatureProductTableMap::UPDATED_AT, ), + self::TYPE_RAW_COLNAME => array('ID', 'PRODUCT_ID', 'FEATURE_ID', 'FEATURE_AV_ID', 'FREE_TEXT_VALUE', 'POSITION', 'CREATED_AT', 'UPDATED_AT', ), + self::TYPE_FIELDNAME => array('id', 'product_id', 'feature_id', 'feature_av_id', 'free_text_value', 'position', 'created_at', 'updated_at', ), self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, ) ); @@ -136,11 +136,11 @@ class FeatureProductTableMap extends TableMap * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 */ protected static $fieldKeys = array ( - self::TYPE_PHPNAME => array('Id' => 0, 'ProductId' => 1, 'FeatureId' => 2, 'FeatureAvId' => 3, 'ByDefault' => 4, 'Position' => 5, 'CreatedAt' => 6, 'UpdatedAt' => 7, ), - self::TYPE_STUDLYPHPNAME => array('id' => 0, 'productId' => 1, 'featureId' => 2, 'featureAvId' => 3, 'byDefault' => 4, 'position' => 5, 'createdAt' => 6, 'updatedAt' => 7, ), - self::TYPE_COLNAME => array(FeatureProductTableMap::ID => 0, FeatureProductTableMap::PRODUCT_ID => 1, FeatureProductTableMap::FEATURE_ID => 2, FeatureProductTableMap::FEATURE_AV_ID => 3, FeatureProductTableMap::BY_DEFAULT => 4, FeatureProductTableMap::POSITION => 5, FeatureProductTableMap::CREATED_AT => 6, FeatureProductTableMap::UPDATED_AT => 7, ), - self::TYPE_RAW_COLNAME => array('ID' => 0, 'PRODUCT_ID' => 1, 'FEATURE_ID' => 2, 'FEATURE_AV_ID' => 3, 'BY_DEFAULT' => 4, 'POSITION' => 5, 'CREATED_AT' => 6, 'UPDATED_AT' => 7, ), - self::TYPE_FIELDNAME => array('id' => 0, 'product_id' => 1, 'feature_id' => 2, 'feature_av_id' => 3, 'by_default' => 4, 'position' => 5, 'created_at' => 6, 'updated_at' => 7, ), + self::TYPE_PHPNAME => array('Id' => 0, 'ProductId' => 1, 'FeatureId' => 2, 'FeatureAvId' => 3, 'FreeTextValue' => 4, 'Position' => 5, 'CreatedAt' => 6, 'UpdatedAt' => 7, ), + self::TYPE_STUDLYPHPNAME => array('id' => 0, 'productId' => 1, 'featureId' => 2, 'featureAvId' => 3, 'freeTextValue' => 4, 'position' => 5, 'createdAt' => 6, 'updatedAt' => 7, ), + self::TYPE_COLNAME => array(FeatureProductTableMap::ID => 0, FeatureProductTableMap::PRODUCT_ID => 1, FeatureProductTableMap::FEATURE_ID => 2, FeatureProductTableMap::FEATURE_AV_ID => 3, FeatureProductTableMap::FREE_TEXT_VALUE => 4, FeatureProductTableMap::POSITION => 5, FeatureProductTableMap::CREATED_AT => 6, FeatureProductTableMap::UPDATED_AT => 7, ), + self::TYPE_RAW_COLNAME => array('ID' => 0, 'PRODUCT_ID' => 1, 'FEATURE_ID' => 2, 'FEATURE_AV_ID' => 3, 'FREE_TEXT_VALUE' => 4, 'POSITION' => 5, 'CREATED_AT' => 6, 'UPDATED_AT' => 7, ), + self::TYPE_FIELDNAME => array('id' => 0, 'product_id' => 1, 'feature_id' => 2, 'feature_av_id' => 3, 'free_text_value' => 4, 'position' => 5, 'created_at' => 6, 'updated_at' => 7, ), self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, ) ); @@ -164,7 +164,7 @@ class FeatureProductTableMap extends TableMap $this->addForeignKey('PRODUCT_ID', 'ProductId', 'INTEGER', 'product', 'ID', true, null, null); $this->addForeignKey('FEATURE_ID', 'FeatureId', 'INTEGER', 'feature', 'ID', true, null, null); $this->addForeignKey('FEATURE_AV_ID', 'FeatureAvId', 'INTEGER', 'feature_av', 'ID', false, null, null); - $this->addColumn('BY_DEFAULT', 'ByDefault', 'VARCHAR', false, 255, null); + $this->addColumn('FREE_TEXT_VALUE', 'FreeTextValue', 'LONGVARCHAR', false, null, null); $this->addColumn('POSITION', 'Position', 'INTEGER', false, null, null); $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null); $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null); @@ -335,7 +335,7 @@ class FeatureProductTableMap extends TableMap $criteria->addSelectColumn(FeatureProductTableMap::PRODUCT_ID); $criteria->addSelectColumn(FeatureProductTableMap::FEATURE_ID); $criteria->addSelectColumn(FeatureProductTableMap::FEATURE_AV_ID); - $criteria->addSelectColumn(FeatureProductTableMap::BY_DEFAULT); + $criteria->addSelectColumn(FeatureProductTableMap::FREE_TEXT_VALUE); $criteria->addSelectColumn(FeatureProductTableMap::POSITION); $criteria->addSelectColumn(FeatureProductTableMap::CREATED_AT); $criteria->addSelectColumn(FeatureProductTableMap::UPDATED_AT); @@ -344,7 +344,7 @@ class FeatureProductTableMap extends TableMap $criteria->addSelectColumn($alias . '.PRODUCT_ID'); $criteria->addSelectColumn($alias . '.FEATURE_ID'); $criteria->addSelectColumn($alias . '.FEATURE_AV_ID'); - $criteria->addSelectColumn($alias . '.BY_DEFAULT'); + $criteria->addSelectColumn($alias . '.FREE_TEXT_VALUE'); $criteria->addSelectColumn($alias . '.POSITION'); $criteria->addSelectColumn($alias . '.CREATED_AT'); $criteria->addSelectColumn($alias . '.UPDATED_AT'); diff --git a/core/lib/Thelia/Model/Map/OrderProductTableMap.php b/core/lib/Thelia/Model/Map/OrderProductTableMap.php index 038d12863..8144f23a7 100644 --- a/core/lib/Thelia/Model/Map/OrderProductTableMap.php +++ b/core/lib/Thelia/Model/Map/OrderProductTableMap.php @@ -57,7 +57,7 @@ class OrderProductTableMap extends TableMap /** * The total number of columns */ - const NUM_COLUMNS = 12; + const NUM_COLUMNS = 19; /** * The number of lazy-loaded columns @@ -67,7 +67,7 @@ class OrderProductTableMap extends TableMap /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 12; + const NUM_HYDRATE_COLUMNS = 19; /** * the column name for the ID field @@ -84,20 +84,30 @@ class OrderProductTableMap extends TableMap */ const PRODUCT_REF = 'order_product.PRODUCT_REF'; + /** + * the column name for the PRODUCT_SALE_ELEMENTS_REF field + */ + const PRODUCT_SALE_ELEMENTS_REF = 'order_product.PRODUCT_SALE_ELEMENTS_REF'; + /** * the column name for the TITLE field */ const TITLE = 'order_product.TITLE'; + /** + * the column name for the CHAPO field + */ + const CHAPO = 'order_product.CHAPO'; + /** * the column name for the DESCRIPTION field */ const DESCRIPTION = 'order_product.DESCRIPTION'; /** - * the column name for the CHAPO field + * the column name for the POSTSCRIPTUM field */ - const CHAPO = 'order_product.CHAPO'; + const POSTSCRIPTUM = 'order_product.POSTSCRIPTUM'; /** * the column name for the QUANTITY field @@ -110,9 +120,34 @@ class OrderProductTableMap extends TableMap const PRICE = 'order_product.PRICE'; /** - * the column name for the TAX field + * the column name for the PROMO_PRICE field */ - const TAX = 'order_product.TAX'; + const PROMO_PRICE = 'order_product.PROMO_PRICE'; + + /** + * the column name for the WAS_NEW field + */ + const WAS_NEW = 'order_product.WAS_NEW'; + + /** + * the column name for the WAS_IN_PROMO field + */ + const WAS_IN_PROMO = 'order_product.WAS_IN_PROMO'; + + /** + * the column name for the WEIGHT field + */ + const WEIGHT = 'order_product.WEIGHT'; + + /** + * the column name for the TAX_RULE_TITLE field + */ + const TAX_RULE_TITLE = 'order_product.TAX_RULE_TITLE'; + + /** + * the column name for the TAX_RULE_DESCRIPTION field + */ + const TAX_RULE_DESCRIPTION = 'order_product.TAX_RULE_DESCRIPTION'; /** * the column name for the PARENT field @@ -141,12 +176,12 @@ class OrderProductTableMap extends TableMap * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ protected static $fieldNames = array ( - self::TYPE_PHPNAME => array('Id', 'OrderId', 'ProductRef', 'Title', 'Description', 'Chapo', 'Quantity', 'Price', 'Tax', 'Parent', 'CreatedAt', 'UpdatedAt', ), - self::TYPE_STUDLYPHPNAME => array('id', 'orderId', 'productRef', 'title', 'description', 'chapo', 'quantity', 'price', 'tax', 'parent', 'createdAt', 'updatedAt', ), - self::TYPE_COLNAME => array(OrderProductTableMap::ID, OrderProductTableMap::ORDER_ID, OrderProductTableMap::PRODUCT_REF, OrderProductTableMap::TITLE, OrderProductTableMap::DESCRIPTION, OrderProductTableMap::CHAPO, OrderProductTableMap::QUANTITY, OrderProductTableMap::PRICE, OrderProductTableMap::TAX, OrderProductTableMap::PARENT, OrderProductTableMap::CREATED_AT, OrderProductTableMap::UPDATED_AT, ), - self::TYPE_RAW_COLNAME => array('ID', 'ORDER_ID', 'PRODUCT_REF', 'TITLE', 'DESCRIPTION', 'CHAPO', 'QUANTITY', 'PRICE', 'TAX', 'PARENT', 'CREATED_AT', 'UPDATED_AT', ), - self::TYPE_FIELDNAME => array('id', 'order_id', 'product_ref', 'title', 'description', 'chapo', 'quantity', 'price', 'tax', 'parent', 'created_at', 'updated_at', ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ) + self::TYPE_PHPNAME => array('Id', 'OrderId', 'ProductRef', 'ProductSaleElementsRef', 'Title', 'Chapo', 'Description', 'Postscriptum', 'Quantity', 'Price', 'PromoPrice', 'WasNew', 'WasInPromo', 'Weight', 'TaxRuleTitle', 'TaxRuleDescription', 'Parent', 'CreatedAt', 'UpdatedAt', ), + self::TYPE_STUDLYPHPNAME => array('id', 'orderId', 'productRef', 'productSaleElementsRef', 'title', 'chapo', 'description', 'postscriptum', 'quantity', 'price', 'promoPrice', 'wasNew', 'wasInPromo', 'weight', 'taxRuleTitle', 'taxRuleDescription', 'parent', 'createdAt', 'updatedAt', ), + self::TYPE_COLNAME => array(OrderProductTableMap::ID, OrderProductTableMap::ORDER_ID, OrderProductTableMap::PRODUCT_REF, OrderProductTableMap::PRODUCT_SALE_ELEMENTS_REF, OrderProductTableMap::TITLE, OrderProductTableMap::CHAPO, OrderProductTableMap::DESCRIPTION, OrderProductTableMap::POSTSCRIPTUM, OrderProductTableMap::QUANTITY, OrderProductTableMap::PRICE, OrderProductTableMap::PROMO_PRICE, OrderProductTableMap::WAS_NEW, OrderProductTableMap::WAS_IN_PROMO, OrderProductTableMap::WEIGHT, OrderProductTableMap::TAX_RULE_TITLE, OrderProductTableMap::TAX_RULE_DESCRIPTION, OrderProductTableMap::PARENT, OrderProductTableMap::CREATED_AT, OrderProductTableMap::UPDATED_AT, ), + self::TYPE_RAW_COLNAME => array('ID', 'ORDER_ID', 'PRODUCT_REF', 'PRODUCT_SALE_ELEMENTS_REF', 'TITLE', 'CHAPO', 'DESCRIPTION', 'POSTSCRIPTUM', 'QUANTITY', 'PRICE', 'PROMO_PRICE', 'WAS_NEW', 'WAS_IN_PROMO', 'WEIGHT', 'TAX_RULE_TITLE', 'TAX_RULE_DESCRIPTION', 'PARENT', 'CREATED_AT', 'UPDATED_AT', ), + self::TYPE_FIELDNAME => array('id', 'order_id', 'product_ref', 'product_sale_elements_ref', 'title', 'chapo', 'description', 'postscriptum', 'quantity', 'price', 'promo_price', 'was_new', 'was_in_promo', 'weight', 'tax_rule_title', 'tax_rule_description', 'parent', 'created_at', 'updated_at', ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, ) ); /** @@ -156,12 +191,12 @@ class OrderProductTableMap extends TableMap * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 */ protected static $fieldKeys = array ( - self::TYPE_PHPNAME => array('Id' => 0, 'OrderId' => 1, 'ProductRef' => 2, 'Title' => 3, 'Description' => 4, 'Chapo' => 5, 'Quantity' => 6, 'Price' => 7, 'Tax' => 8, 'Parent' => 9, 'CreatedAt' => 10, 'UpdatedAt' => 11, ), - self::TYPE_STUDLYPHPNAME => array('id' => 0, 'orderId' => 1, 'productRef' => 2, 'title' => 3, 'description' => 4, 'chapo' => 5, 'quantity' => 6, 'price' => 7, 'tax' => 8, 'parent' => 9, 'createdAt' => 10, 'updatedAt' => 11, ), - self::TYPE_COLNAME => array(OrderProductTableMap::ID => 0, OrderProductTableMap::ORDER_ID => 1, OrderProductTableMap::PRODUCT_REF => 2, OrderProductTableMap::TITLE => 3, OrderProductTableMap::DESCRIPTION => 4, OrderProductTableMap::CHAPO => 5, OrderProductTableMap::QUANTITY => 6, OrderProductTableMap::PRICE => 7, OrderProductTableMap::TAX => 8, OrderProductTableMap::PARENT => 9, OrderProductTableMap::CREATED_AT => 10, OrderProductTableMap::UPDATED_AT => 11, ), - self::TYPE_RAW_COLNAME => array('ID' => 0, 'ORDER_ID' => 1, 'PRODUCT_REF' => 2, 'TITLE' => 3, 'DESCRIPTION' => 4, 'CHAPO' => 5, 'QUANTITY' => 6, 'PRICE' => 7, 'TAX' => 8, 'PARENT' => 9, 'CREATED_AT' => 10, 'UPDATED_AT' => 11, ), - self::TYPE_FIELDNAME => array('id' => 0, 'order_id' => 1, 'product_ref' => 2, 'title' => 3, 'description' => 4, 'chapo' => 5, 'quantity' => 6, 'price' => 7, 'tax' => 8, 'parent' => 9, 'created_at' => 10, 'updated_at' => 11, ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ) + self::TYPE_PHPNAME => array('Id' => 0, 'OrderId' => 1, 'ProductRef' => 2, 'ProductSaleElementsRef' => 3, 'Title' => 4, 'Chapo' => 5, 'Description' => 6, 'Postscriptum' => 7, 'Quantity' => 8, 'Price' => 9, 'PromoPrice' => 10, 'WasNew' => 11, 'WasInPromo' => 12, 'Weight' => 13, 'TaxRuleTitle' => 14, 'TaxRuleDescription' => 15, 'Parent' => 16, 'CreatedAt' => 17, 'UpdatedAt' => 18, ), + self::TYPE_STUDLYPHPNAME => array('id' => 0, 'orderId' => 1, 'productRef' => 2, 'productSaleElementsRef' => 3, 'title' => 4, 'chapo' => 5, 'description' => 6, 'postscriptum' => 7, 'quantity' => 8, 'price' => 9, 'promoPrice' => 10, 'wasNew' => 11, 'wasInPromo' => 12, 'weight' => 13, 'taxRuleTitle' => 14, 'taxRuleDescription' => 15, 'parent' => 16, 'createdAt' => 17, 'updatedAt' => 18, ), + self::TYPE_COLNAME => array(OrderProductTableMap::ID => 0, OrderProductTableMap::ORDER_ID => 1, OrderProductTableMap::PRODUCT_REF => 2, OrderProductTableMap::PRODUCT_SALE_ELEMENTS_REF => 3, OrderProductTableMap::TITLE => 4, OrderProductTableMap::CHAPO => 5, OrderProductTableMap::DESCRIPTION => 6, OrderProductTableMap::POSTSCRIPTUM => 7, OrderProductTableMap::QUANTITY => 8, OrderProductTableMap::PRICE => 9, OrderProductTableMap::PROMO_PRICE => 10, OrderProductTableMap::WAS_NEW => 11, OrderProductTableMap::WAS_IN_PROMO => 12, OrderProductTableMap::WEIGHT => 13, OrderProductTableMap::TAX_RULE_TITLE => 14, OrderProductTableMap::TAX_RULE_DESCRIPTION => 15, OrderProductTableMap::PARENT => 16, OrderProductTableMap::CREATED_AT => 17, OrderProductTableMap::UPDATED_AT => 18, ), + self::TYPE_RAW_COLNAME => array('ID' => 0, 'ORDER_ID' => 1, 'PRODUCT_REF' => 2, 'PRODUCT_SALE_ELEMENTS_REF' => 3, 'TITLE' => 4, 'CHAPO' => 5, 'DESCRIPTION' => 6, 'POSTSCRIPTUM' => 7, 'QUANTITY' => 8, 'PRICE' => 9, 'PROMO_PRICE' => 10, 'WAS_NEW' => 11, 'WAS_IN_PROMO' => 12, 'WEIGHT' => 13, 'TAX_RULE_TITLE' => 14, 'TAX_RULE_DESCRIPTION' => 15, 'PARENT' => 16, 'CREATED_AT' => 17, 'UPDATED_AT' => 18, ), + self::TYPE_FIELDNAME => array('id' => 0, 'order_id' => 1, 'product_ref' => 2, 'product_sale_elements_ref' => 3, 'title' => 4, 'chapo' => 5, 'description' => 6, 'postscriptum' => 7, 'quantity' => 8, 'price' => 9, 'promo_price' => 10, 'was_new' => 11, 'was_in_promo' => 12, 'weight' => 13, 'tax_rule_title' => 14, 'tax_rule_description' => 15, 'parent' => 16, 'created_at' => 17, 'updated_at' => 18, ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, ) ); /** @@ -182,13 +217,20 @@ class OrderProductTableMap extends TableMap // columns $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); $this->addForeignKey('ORDER_ID', 'OrderId', 'INTEGER', 'order', 'ID', true, null, null); - $this->addColumn('PRODUCT_REF', 'ProductRef', 'VARCHAR', false, 255, null); + $this->addColumn('PRODUCT_REF', 'ProductRef', 'VARCHAR', true, 255, null); + $this->addColumn('PRODUCT_SALE_ELEMENTS_REF', 'ProductSaleElementsRef', 'VARCHAR', true, 255, null); $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null); - $this->addColumn('DESCRIPTION', 'Description', 'LONGVARCHAR', false, null, null); $this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null); + $this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null); + $this->addColumn('POSTSCRIPTUM', 'Postscriptum', 'LONGVARCHAR', false, null, null); $this->addColumn('QUANTITY', 'Quantity', 'FLOAT', true, null, null); $this->addColumn('PRICE', 'Price', 'FLOAT', true, null, null); - $this->addColumn('TAX', 'Tax', 'FLOAT', false, null, null); + $this->addColumn('PROMO_PRICE', 'PromoPrice', 'VARCHAR', false, 45, null); + $this->addColumn('WAS_NEW', 'WasNew', 'TINYINT', true, null, null); + $this->addColumn('WAS_IN_PROMO', 'WasInPromo', 'TINYINT', true, null, null); + $this->addColumn('WEIGHT', 'Weight', 'VARCHAR', false, 45, null); + $this->addColumn('TAX_RULE_TITLE', 'TaxRuleTitle', 'VARCHAR', false, 255, null); + $this->addColumn('TAX_RULE_DESCRIPTION', 'TaxRuleDescription', 'CLOB', false, null, null); $this->addColumn('PARENT', 'Parent', 'INTEGER', false, null, null); $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null); $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null); @@ -200,7 +242,8 @@ class OrderProductTableMap extends TableMap public function buildRelations() { $this->addRelation('Order', '\\Thelia\\Model\\Order', RelationMap::MANY_TO_ONE, array('order_id' => 'id', ), 'CASCADE', 'RESTRICT'); - $this->addRelation('OrderFeature', '\\Thelia\\Model\\OrderFeature', RelationMap::ONE_TO_MANY, array('id' => 'order_product_id', ), 'CASCADE', 'RESTRICT', 'OrderFeatures'); + $this->addRelation('OrderProductAttributeCombination', '\\Thelia\\Model\\OrderProductAttributeCombination', RelationMap::ONE_TO_MANY, array('id' => 'order_product_id', ), 'CASCADE', 'RESTRICT', 'OrderProductAttributeCombinations'); + $this->addRelation('OrderProductTax', '\\Thelia\\Model\\OrderProductTax', RelationMap::ONE_TO_MANY, array('id' => 'order_product_id', ), 'CASCADE', 'RESTRICT', 'OrderProductTaxes'); } // buildRelations() /** @@ -222,7 +265,8 @@ class OrderProductTableMap extends TableMap { // Invalidate objects in ".$this->getClassNameFromBuilder($joinedTableTableMapBuilder)." instance pool, // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. - OrderFeatureTableMap::clearInstancePool(); + OrderProductAttributeCombinationTableMap::clearInstancePool(); + OrderProductTaxTableMap::clearInstancePool(); } /** @@ -366,12 +410,19 @@ class OrderProductTableMap extends TableMap $criteria->addSelectColumn(OrderProductTableMap::ID); $criteria->addSelectColumn(OrderProductTableMap::ORDER_ID); $criteria->addSelectColumn(OrderProductTableMap::PRODUCT_REF); + $criteria->addSelectColumn(OrderProductTableMap::PRODUCT_SALE_ELEMENTS_REF); $criteria->addSelectColumn(OrderProductTableMap::TITLE); - $criteria->addSelectColumn(OrderProductTableMap::DESCRIPTION); $criteria->addSelectColumn(OrderProductTableMap::CHAPO); + $criteria->addSelectColumn(OrderProductTableMap::DESCRIPTION); + $criteria->addSelectColumn(OrderProductTableMap::POSTSCRIPTUM); $criteria->addSelectColumn(OrderProductTableMap::QUANTITY); $criteria->addSelectColumn(OrderProductTableMap::PRICE); - $criteria->addSelectColumn(OrderProductTableMap::TAX); + $criteria->addSelectColumn(OrderProductTableMap::PROMO_PRICE); + $criteria->addSelectColumn(OrderProductTableMap::WAS_NEW); + $criteria->addSelectColumn(OrderProductTableMap::WAS_IN_PROMO); + $criteria->addSelectColumn(OrderProductTableMap::WEIGHT); + $criteria->addSelectColumn(OrderProductTableMap::TAX_RULE_TITLE); + $criteria->addSelectColumn(OrderProductTableMap::TAX_RULE_DESCRIPTION); $criteria->addSelectColumn(OrderProductTableMap::PARENT); $criteria->addSelectColumn(OrderProductTableMap::CREATED_AT); $criteria->addSelectColumn(OrderProductTableMap::UPDATED_AT); @@ -379,12 +430,19 @@ class OrderProductTableMap extends TableMap $criteria->addSelectColumn($alias . '.ID'); $criteria->addSelectColumn($alias . '.ORDER_ID'); $criteria->addSelectColumn($alias . '.PRODUCT_REF'); + $criteria->addSelectColumn($alias . '.PRODUCT_SALE_ELEMENTS_REF'); $criteria->addSelectColumn($alias . '.TITLE'); - $criteria->addSelectColumn($alias . '.DESCRIPTION'); $criteria->addSelectColumn($alias . '.CHAPO'); + $criteria->addSelectColumn($alias . '.DESCRIPTION'); + $criteria->addSelectColumn($alias . '.POSTSCRIPTUM'); $criteria->addSelectColumn($alias . '.QUANTITY'); $criteria->addSelectColumn($alias . '.PRICE'); - $criteria->addSelectColumn($alias . '.TAX'); + $criteria->addSelectColumn($alias . '.PROMO_PRICE'); + $criteria->addSelectColumn($alias . '.WAS_NEW'); + $criteria->addSelectColumn($alias . '.WAS_IN_PROMO'); + $criteria->addSelectColumn($alias . '.WEIGHT'); + $criteria->addSelectColumn($alias . '.TAX_RULE_TITLE'); + $criteria->addSelectColumn($alias . '.TAX_RULE_DESCRIPTION'); $criteria->addSelectColumn($alias . '.PARENT'); $criteria->addSelectColumn($alias . '.CREATED_AT'); $criteria->addSelectColumn($alias . '.UPDATED_AT'); diff --git a/core/lib/Thelia/Model/Map/ProductSaleElementsTableMap.php b/core/lib/Thelia/Model/Map/ProductSaleElementsTableMap.php index fc23ae569..70b3819f9 100644 --- a/core/lib/Thelia/Model/Map/ProductSaleElementsTableMap.php +++ b/core/lib/Thelia/Model/Map/ProductSaleElementsTableMap.php @@ -167,7 +167,7 @@ class ProductSaleElementsTableMap extends TableMap // columns $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); $this->addForeignKey('PRODUCT_ID', 'ProductId', 'INTEGER', 'product', 'ID', true, null, null); - $this->addColumn('REF', 'Ref', 'VARCHAR', true, 45, null); + $this->addColumn('REF', 'Ref', 'VARCHAR', true, 255, null); $this->addColumn('QUANTITY', 'Quantity', 'FLOAT', true, null, null); $this->addColumn('PROMO', 'Promo', 'TINYINT', false, null, 0); $this->addColumn('NEWNESS', 'Newness', 'TINYINT', false, null, 0); diff --git a/core/lib/Thelia/Model/Map/TaxI18nTableMap.php b/core/lib/Thelia/Model/Map/TaxI18nTableMap.php index a06230c37..c50a30c90 100644 --- a/core/lib/Thelia/Model/Map/TaxI18nTableMap.php +++ b/core/lib/Thelia/Model/Map/TaxI18nTableMap.php @@ -143,7 +143,7 @@ class TaxI18nTableMap extends TableMap $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'tax', 'ID', true, null, null); $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US'); $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null); - $this->addColumn('DESCRIPTION', 'Description', 'LONGVARCHAR', false, null, null); + $this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null); } // initialize() /** diff --git a/core/lib/Thelia/Model/Map/TaxRuleI18nTableMap.php b/core/lib/Thelia/Model/Map/TaxRuleI18nTableMap.php index 012ad2e72..24f8a41d7 100644 --- a/core/lib/Thelia/Model/Map/TaxRuleI18nTableMap.php +++ b/core/lib/Thelia/Model/Map/TaxRuleI18nTableMap.php @@ -143,7 +143,7 @@ class TaxRuleI18nTableMap extends TableMap $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'tax_rule', 'ID', true, null, null); $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US'); $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null); - $this->addColumn('DESCRIPTION', 'Description', 'LONGVARCHAR', false, null, null); + $this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null); } // initialize() /** diff --git a/install/faker.php b/install/faker.php index eed6db11a..2c82f5d1b 100755 --- a/install/faker.php +++ b/install/faker.php @@ -442,7 +442,7 @@ try { $featureAvId[array_rand($featureAvId, 1)] ); } else { //no av - $featureProduct->setByDefault($faker->text(10)); + $featureProduct->setFreeTextValue($faker->text(10)); } $featureProduct->save(); diff --git a/install/thelia.sql b/install/thelia.sql index bd983d26d..efa72b629 100755 --- a/install/thelia.sql +++ b/install/thelia.sql @@ -51,7 +51,7 @@ CREATE TABLE `product` REFERENCES `tax_rule` (`id`) ON UPDATE RESTRICT ON DELETE SET NULL, - CONSTRAINT `fk_product_template1` + CONSTRAINT `fk_product_template` FOREIGN KEY (`template_id`) REFERENCES `template` (`id`) ) ENGINE=InnoDB; @@ -226,7 +226,7 @@ CREATE TABLE `feature_product` `product_id` INTEGER NOT NULL, `feature_id` INTEGER NOT NULL, `feature_av_id` INTEGER, - `by_default` VARCHAR(255), + `free_text_value` TEXT, `position` INTEGER, `created_at` DATETIME, `updated_at` DATETIME, @@ -325,6 +325,7 @@ CREATE TABLE `attribute_combination` `attribute_id` INTEGER NOT NULL, `attribute_av_id` INTEGER NOT NULL, `product_sale_elements_id` INTEGER NOT NULL, + `is_default` TINYINT(1) DEFAULT 0, `created_at` DATETIME, `updated_at` DATETIME, PRIMARY KEY (`attribute_id`,`attribute_av_id`,`product_sale_elements_id`), @@ -358,7 +359,7 @@ CREATE TABLE `product_sale_elements` ( `id` INTEGER NOT NULL AUTO_INCREMENT, `product_id` INTEGER NOT NULL, - `ref` VARCHAR(45) NOT NULL, + `ref` VARCHAR(255) NOT NULL, `quantity` FLOAT NOT NULL, `promo` TINYINT DEFAULT 0, `newness` TINYINT DEFAULT 0, @@ -760,14 +761,21 @@ CREATE TABLE `order_product` ( `id` INTEGER NOT NULL AUTO_INCREMENT, `order_id` INTEGER NOT NULL, - `product_ref` VARCHAR(255), + `product_ref` VARCHAR(255) NOT NULL, + `product_sale_elements_ref` VARCHAR(255) NOT NULL, `title` VARCHAR(255), - `description` TEXT, `chapo` TEXT, + `description` LONGTEXT, + `postscriptum` TEXT, `quantity` FLOAT NOT NULL, `price` FLOAT NOT NULL, - `tax` FLOAT, - `parent` INTEGER, + `promo_price` VARCHAR(45), + `was_new` TINYINT NOT NULL, + `was_in_promo` TINYINT NOT NULL, + `weight` VARCHAR(45), + `tax_rule_title` VARCHAR(255), + `tax_rule_description` LONGTEXT, + `parent` INTEGER COMMENT 'not managed yet', `created_at` DATETIME, `updated_at` DATETIME, PRIMARY KEY (`id`), @@ -796,22 +804,28 @@ CREATE TABLE `order_status` ) ENGINE=InnoDB; -- --------------------------------------------------------------------- --- order_feature +-- order_product_attribute_combination -- --------------------------------------------------------------------- -DROP TABLE IF EXISTS `order_feature`; +DROP TABLE IF EXISTS `order_product_attribute_combination`; -CREATE TABLE `order_feature` +CREATE TABLE `order_product_attribute_combination` ( `id` INTEGER NOT NULL AUTO_INCREMENT, `order_product_id` INTEGER NOT NULL, - `feature_desc` VARCHAR(255), - `feature_av_desc` VARCHAR(255), + `attribute_title` VARCHAR(255) NOT NULL, + `attribute_chapo` TEXT, + `attribute_description` LONGTEXT, + `attribute_postscriptumn` TEXT, + `attribute_av_title` VARCHAR(255) NOT NULL, + `attribute_av_chapo` TEXT, + `attribute_av_description` LONGTEXT, + `attribute_av_postscriptum` TEXT, `created_at` DATETIME, `updated_at` DATETIME, PRIMARY KEY (`id`), - INDEX `idx_order_feature_order_product_id` (`order_product_id`), - CONSTRAINT `fk_order_feature_order_product_id` + INDEX `idx_order_product_attribute_combination_order_product_id` (`order_product_id`), + CONSTRAINT `fk_order_product_attribute_combination_order_product_id` FOREIGN KEY (`order_product_id`) REFERENCES `order_product` (`id`) ON UPDATE RESTRICT @@ -1560,6 +1574,30 @@ CREATE TABLE `module_image` ON DELETE CASCADE ) ENGINE=InnoDB; +-- --------------------------------------------------------------------- +-- order_product_tax +-- --------------------------------------------------------------------- + +DROP TABLE IF EXISTS `order_product_tax`; + +CREATE TABLE `order_product_tax` +( + `id` INTEGER NOT NULL AUTO_INCREMENT, + `order_product_id` INTEGER NOT NULL, + `title` VARCHAR(255) NOT NULL, + `description` LONGTEXT, + `amount` FLOAT NOT NULL, + `created_at` DATETIME, + `updated_at` DATETIME, + PRIMARY KEY (`id`), + INDEX `idx_ order_product_tax_order_product_id` (`order_product_id`), + CONSTRAINT `fk_ order_product_tax_order_product_id0` + FOREIGN KEY (`order_product_id`) + REFERENCES `order_product` (`id`) + ON UPDATE RESTRICT + ON DELETE CASCADE +) ENGINE=InnoDB; + -- --------------------------------------------------------------------- -- category_i18n -- --------------------------------------------------------------------- @@ -1634,7 +1672,7 @@ CREATE TABLE `tax_i18n` `id` INTEGER NOT NULL, `locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL, `title` VARCHAR(255), - `description` TEXT, + `description` LONGTEXT, PRIMARY KEY (`id`,`locale`), CONSTRAINT `tax_i18n_FK_1` FOREIGN KEY (`id`) @@ -1653,7 +1691,7 @@ CREATE TABLE `tax_rule_i18n` `id` INTEGER NOT NULL, `locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL, `title` VARCHAR(255), - `description` TEXT, + `description` LONGTEXT, PRIMARY KEY (`id`,`locale`), CONSTRAINT `tax_rule_i18n_FK_1` FOREIGN KEY (`id`) diff --git a/local/config/schema.xml b/local/config/schema.xml index b767580ef..98cf32ffb 100755 --- a/local/config/schema.xml +++ b/local/config/schema.xml @@ -1,1227 +1,1255 @@ - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - -
- - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - -
- - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - -
- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - -
- - - - - - - - - - - - - - -
- - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - -
- - - - - - - - -
- - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - -
- - - - - - - -
- - - - - - - - - - - - - - - - - - - -
-
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + +
+ + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + +
+ + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + +
+
diff --git a/templates/admin/default/ajax/template-attribute-list.html b/templates/admin/default/ajax/template-attribute-list.html index a630aaa61..7276e6005 100644 --- a/templates/admin/default/ajax/template-attribute-list.html +++ b/templates/admin/default/ajax/template-attribute-list.html @@ -6,7 +6,7 @@
- + {loop name="free_features" type="feature" exclude_template="$template_id" backend_context="1" lang="$edit_language_id"} {/loop} diff --git a/templates/admin/default/category-edit.html b/templates/admin/default/category-edit.html index b974a4564..63dbbfdb1 100755 --- a/templates/admin/default/category-edit.html +++ b/templates/admin/default/category-edit.html @@ -163,7 +163,7 @@
- + diff --git a/templates/admin/default/feature-edit.html b/templates/admin/default/feature-edit.html index a21c63f61..41a6276b9 100644 --- a/templates/admin/default/feature-edit.html +++ b/templates/admin/default/feature-edit.html @@ -1,6 +1,6 @@ {extends file="admin-layout.tpl"} -{block name="page-title"}{intl l='Edit an feature'}{/block} +{block name="page-title"}{intl l='Edit a feature'}{/block} {block name="check-permissions"}admin.configuration.features.edit{/block} @@ -75,9 +75,9 @@

- {intl l="Enter here all possible feature values."} + {intl l="Enter here all possible feature values. To get a free text feature in product forms, don't add any value."}
- +
@@ -122,7 +122,7 @@ - {loop name="list" type="feature_availability" feature=$feature_id backend_context="1" lang=$edit_language_id order=$featureav_order} + {loop name="list" type="feature-availability" feature=$feature_id backend_context="1" lang=$edit_language_id order=$featureav_order} diff --git a/templates/admin/default/folder-edit.html b/templates/admin/default/folder-edit.html index 6986a1e69..cfe835ef5 100644 --- a/templates/admin/default/folder-edit.html +++ b/templates/admin/default/folder-edit.html @@ -161,7 +161,7 @@
- + diff --git a/templates/admin/default/includes/standard-description-form-fields.html b/templates/admin/default/includes/standard-description-form-fields.html index 17c340b27..ca78324ad 100644 --- a/templates/admin/default/includes/standard-description-form-fields.html +++ b/templates/admin/default/includes/standard-description-form-fields.html @@ -22,7 +22,7 @@
diff --git a/templates/admin/default/product-edit.html b/templates/admin/default/product-edit.html index d80d9ca0a..4464e0071 100644 --- a/templates/admin/default/product-edit.html +++ b/templates/admin/default/product-edit.html @@ -41,7 +41,8 @@
{$ID}
- - - - - - - {module_include location='product_contents_table_header'} - - - - - - - {loop name="assigned_contents" type="associated_content" product="$product_id" backend_context="1" lang="$edit_language_id"} - - - - - - {module_include location='product_contents_table_row'} - - - - {/loop} - - {elseloop rel="assigned_contents"} - - - - {/elseloop} - -
{intl l='ID'}{intl l='Content title'}{intl l="Actions"}
{$ID} - {$TITLE} - -
- {loop type="auth" name="can_create" roles="ADMIN" permissions="admin.configuration.product.content.delete"} - - - - {/loop} -
-
-
- {intl l="This product contains no contents"} -
-
-
- - {* -- End related content management ---- *} - - {* -- Begin accessories management ------ *} - -
-
-
- -

{intl l='Product accessories'}

-

{intl l='Define here this product\'s accessories'}

- - - - - {ifloop rel="categories"} -
- - - {intl l='Select a category to get its products'} -
- -
-
- - - - -
- - {intl l='Select a product and click (+) to add it as an accessory'} -
- -
-
- {intl l="No available product in this category"} -
-
- - {/ifloop} - - {elseloop rel="categories"} -
{intl l="No categories found"}
- {/elseloop} - -
-
- - - - - - - - - - - {module_include location='product_accessories_table_header'} - - - - - - - {loop name="assigned_accessories" order="accessory" type="accessory" product="$product_id" backend_context="1" lang="$edit_language_id"} - - - - - - - - {module_include location='product_accessories_table_row'} - - - - {/loop} - - {elseloop rel="assigned_accessories"} - - - - {/elseloop} - -
{intl l='ID'}{intl l='Accessory title'}{intl l='Position'}{intl l="Actions"}
{$ID} - {$TITLE} - - {admin_position_block - permission="admin.products.edit" - path={url path='/admin/products/update-accessory-position' product_id=$ID} - url_parameter="accessory_id" - in_place_edit_class="accessoryPositionChange" - position=$POSITION - id=$ID - } - -
- {loop type="auth" name="can_create" roles="ADMIN" permissions="admin.configuration.product.accessory.delete"} - - - - {/loop} -
-
-
- {intl l="This product contains no accessories"} -
-
-
- - {* -- End accessories management -------- *} - -
@@ -397,48 +85,6 @@
- -{* Delete related content confirmation dialog *} - -{capture "delete_content_dialog"} - - - - - -{/capture} - -{include - file = "includes/generic-confirm-dialog.html" - - dialog_id = "delete_content_dialog" - dialog_title = {intl l="Remove related content"} - dialog_message = {intl l="Do you really want to remove this related content from the product ?"} - - form_action = {url path='/admin/products/related-content/delete'} - form_content = {$smarty.capture.delete_content_dialog nofilter} -} - -{* Delete accessory confirmation dialog *} - -{capture "delete_accessory_dialog"} - - - - - -{/capture} - -{include - file = "includes/generic-confirm-dialog.html" - - dialog_id = "delete_accessory_dialog" - dialog_title = {intl l="Remove an accessory"} - dialog_message = {intl l="Do you really want to remove this accessory from the product ?"} - - form_action = {url path='/admin/products/accessory/delete'} - form_content = {$smarty.capture.delete_accessory_dialog nofilter} -} {/block} {block name="javascript-initialization"} @@ -594,6 +240,13 @@ $(function() { {if $accessory_category_id != 0} $('#accessory_category_id').val("{$accessory_category_id}").change(); {/if} + + // Unselect all options in attribute + feature tab + $('.clear_feature_value').click(function(event){ + $('#feature_value_' + $(this).data('id') + ' option').prop('selected', false); + + event.preventDefault(); + }); }); {/block} \ No newline at end of file