diff --git a/core/lib/Thelia/Core/Template/Loop/AttributeCombination.php b/core/lib/Thelia/Core/Template/Loop/AttributeCombination.php index bae58b38b..dcb7dd050 100644 --- a/core/lib/Thelia/Core/Template/Loop/AttributeCombination.php +++ b/core/lib/Thelia/Core/Template/Loop/AttributeCombination.php @@ -103,6 +103,8 @@ class AttributeCombination extends BaseI18nLoop implements PropelSearchLoopInter $loopResultRow = new LoopResultRow($attributeCombination); $loopResultRow + ->set("ATTRIBUTE_ID", $attributeCombination->getAttributeId()) + ->set("ATTRIBUTE_AVAILABILITY_ID", $attributeCombination->getAttributeAvId()) ->set("LOCALE",$this->locale) ->set("ATTRIBUTE_TITLE", $attributeCombination->getVirtualColumn(AttributeTableMap::TABLE_NAME . '_i18n_TITLE')) ->set("ATTRIBUTE_CHAPO", $attributeCombination->getVirtualColumn(AttributeTableMap::TABLE_NAME . '_i18n_CHAPO')) diff --git a/core/lib/Thelia/Tests/Action/BrandTest.php b/core/lib/Thelia/Tests/Action/BrandTest.php index e741e8cb0..5f47feb6b 100644 --- a/core/lib/Thelia/Tests/Action/BrandTest.php +++ b/core/lib/Thelia/Tests/Action/BrandTest.php @@ -155,6 +155,8 @@ class BrandTest extends TestCaseWithURLToolSetup public function testUpdatePositionUp() { + $this->resetBrandPosition(); + $brand = BrandQuery::create() ->filterByPosition(1, Criteria::GREATER_THAN) ->findOne(); @@ -178,6 +180,8 @@ class BrandTest extends TestCaseWithURLToolSetup public function testUpdatePositionDown() { + $this->resetBrandPosition(); + $brand = BrandQuery::create() ->filterByPosition(1) ->findOne(); @@ -201,6 +205,8 @@ class BrandTest extends TestCaseWithURLToolSetup public function testUpdatePositionWithSpecificPosition() { + $this->resetBrandPosition(); + $brand = BrandQuery::create() ->filterByPosition(1, Criteria::GREATER_THAN) ->findOne(); @@ -219,6 +225,23 @@ class BrandTest extends TestCaseWithURLToolSetup $this->assertEquals(1, $updatedBrand->getPosition(),sprintf("new position is 1, new position expected is %d for brand %d", $updatedBrand->getPosition(), $updatedBrand->getId())); } + + /** + * Reorder brand to have proper position + */ + protected function resetBrandPosition() + { + $brands = BrandQuery::create()->find(); + $counter = 1; + + /** @var \Thelia\Model\Brand $brand */ + foreach ($brands as $brand) { + $brand->setPosition($counter); + $brand->save(); + $counter++; + } + } + /** * @return \Thelia\Model\Brand */ diff --git a/core/lib/Thelia/Tools/URL.php b/core/lib/Thelia/Tools/URL.php index 330baa178..65a03ed65 100644 --- a/core/lib/Thelia/Tools/URL.php +++ b/core/lib/Thelia/Tools/URL.php @@ -154,6 +154,7 @@ class URL $base = $path; $queryString = ''; + $anchor = ''; if (! is_null($parameters)) { foreach ($parameters as $name => $value) { @@ -167,6 +168,14 @@ class URL if ('' !== $queryString = rtrim($queryString, "&")) { + // url could contain anchor + $pos = strrpos($base, '#'); + if($pos !== false) { + $anchor = substr($base, $pos); + $base = substr($base, 0, $pos); + } + + $base = rtrim($base, "?&"); $sepChar = strstr($base, '?') === false ? '?' : '&'; @@ -174,7 +183,7 @@ class URL $queryString = $sepChar . $queryString; } - return $base . $queryString; + return $base . $queryString . $anchor; } /** diff --git a/core/lib/Thelia/Type/ModelValidIdType.php b/core/lib/Thelia/Type/ModelValidIdType.php index e3419fdd2..10185fe28 100644 --- a/core/lib/Thelia/Type/ModelValidIdType.php +++ b/core/lib/Thelia/Type/ModelValidIdType.php @@ -13,6 +13,7 @@ namespace Thelia\Type; use Propel\Runtime\ActiveQuery\ModelCriteria; +use Thelia\Core\Translation\Translator; use Thelia\Exception\TypeException; /** @@ -67,8 +68,16 @@ class ModelValidIdType extends BaseType { $queryClass = $this->expectedModelActiveRecordQuery; + $query = $queryClass::create(); + + if (method_exists($query, "joinWithI18n")) { + if (null !== $locale = Translator::getInstance()->getLocale()) { + $query->joinWithI18n($locale); + } + } + $choices = array(); - foreach ($queryClass::create()->find() as $item) { + foreach ($query->find() as $item) { $choices[$item->getId()] = method_exists($item, "getTitle") ? $item->getTitle() : $item->getId(); } diff --git a/setup/update/2.0.3.sql b/setup/update/2.0.3.sql index d27545f91..ab62ff427 100644 --- a/setup/update/2.0.3.sql +++ b/setup/update/2.0.3.sql @@ -250,9 +250,13 @@ CREATE TABLE `brand_image_i18n` -- Add brand field to product table, and related constraint. -- --------------------------------------------------------- -ALTER TABLE `product` ADD `brand_id` INTEGER DEFAULT 0 AFTER `template_id`; +ALTER TABLE `product` ADD `brand_id` INTEGER AFTER `template_id`; ALTER TABLE `product` ADD CONSTRAINT `fk_product_brand` FOREIGN KEY (`brand_id`) REFERENCES `brand` (`id`) ON DELETE SET NULL; +ALTER TABLE `product_version` ADD `brand_id` INTEGER AFTER `template_id`; +ALTER TABLE `product_version` ADD CONSTRAINT `fk_product_version_brand` FOREIGN KEY (`brand_id`) REFERENCES `brand` (`id`) ON DELETE SET NULL; + + # Add html_output_trim_level config variable # ------------------------------------------ diff --git a/templates/backOffice/default/ajax/product-attributes-tab.html b/templates/backOffice/default/ajax/product-attributes-tab.html index 9e1d56feb..31877f729 100644 --- a/templates/backOffice/default/ajax/product-attributes-tab.html +++ b/templates/backOffice/default/ajax/product-attributes-tab.html @@ -232,6 +232,16 @@ + + {include + file = "includes/inner-form-toolbar.html" + hide_submit_buttons = false + hide_flags = true + + page_url = "{url path='/admin/products/update' product_id=$ID}" + close_url = "{url path='/admin/categories' category_id=$DEFAULT_CATEGORY}" + } + diff --git a/templates/backOffice/default/categories.html b/templates/backOffice/default/categories.html index 2cd4e0309..13eb59ed5 100644 --- a/templates/backOffice/default/categories.html +++ b/templates/backOffice/default/categories.html @@ -50,7 +50,7 @@ current_order=$category_order order='id' reverse_order='id_reverse' - path={url path='/admin/categories' id_category=$category_id} + path={url path='/admin/catalog' category_id=$category_id} request_parameter_name='category_order' label="{intl l='ID'}" } @@ -63,7 +63,7 @@ current_order=$category_order order='alpha' reverse_order='alpha_reverse' - path={url path='/admin/categories' id_category=$category_id} + path={url path='/admin/catalog' category_id=$category_id} request_parameter_name='category_order' label="{intl l='Category title'}" } @@ -76,7 +76,7 @@ current_order=$category_order order='visible' reverse_order='visible_reverse' - path={url path='/admin/categories' id_category=$category_id} + path={url path='/admin/catalog' category_id=$category_id} request_parameter_name='category_order' label="{intl l='Online'}" } @@ -87,7 +87,7 @@ current_order=$category_order order='manual' reverse_order='manual_reverse' - path={url path='/admin/categories' id_category=$category_id} + path={url path='/admin/catalog' category_id=$category_id} request_parameter_name='category_order' label="{intl l='Position'}" } @@ -187,6 +187,10 @@ {* No product on toplevel category, e.g. id_category = 0 *} + {loop type="currency" name="product-currency" id=$edit_currency_id backend_context="1"} + {$currency_symbol = $SYMBOL} + {/loop} + {if $category_id > 0}
| {intl l="Customer"} | +{$orderInvoiceFirstName|ucwords} {$orderInvoiceLastName|upper} | +
|---|---|
| {intl l="Company"} | +{$orderInvoiceCompany} | +