Merge pull request #532 from bibich/improvements
small corrections and improvements, especially on the backoffice template.
This commit is contained in:
@@ -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'))
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
# ------------------------------------------
|
||||
|
||||
|
||||
@@ -232,6 +232,16 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{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}"
|
||||
}
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -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}
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
@@ -218,7 +222,8 @@
|
||||
current_order=$product_order
|
||||
order='id'
|
||||
reverse_order='id_reverse'
|
||||
path={url path='/admin/categories' id_category=$category_id target='products'}
|
||||
path={url path='/admin/catalog' category_id=$category_id target='products'}
|
||||
request_parameter_name='product_order'
|
||||
label="{intl l='ID'}"
|
||||
}
|
||||
|
||||
@@ -229,7 +234,8 @@
|
||||
current_order=$product_order
|
||||
order='ref'
|
||||
reverse_order='ref_reverse'
|
||||
path={url path='/admin/categories' id_category=$category_id target='products'}
|
||||
path={url path='/admin/catalog' category_id=$category_id target='products'}
|
||||
request_parameter_name='product_order'
|
||||
label="{intl l='Reference'}"
|
||||
}
|
||||
</th>
|
||||
@@ -239,28 +245,42 @@
|
||||
current_order=$product_order
|
||||
order='alpha'
|
||||
reverse_order='alpha_reverse'
|
||||
path={url path='/admin/categories' id_category=$category_id target='products'}
|
||||
path={url path='/admin/catalog' category_id=$category_id target='products'}
|
||||
request_parameter_name='product_order'
|
||||
label="{intl l='Product title'}"
|
||||
}
|
||||
|
||||
{module_include location='product_list_header'}
|
||||
|
||||
<th>
|
||||
{admin_sortable_header
|
||||
current_order=$product_order
|
||||
order='visible'
|
||||
reverse_order='visible_reverse'
|
||||
path={url path='/admin/categories' id_category=$category_id target='products'}
|
||||
label="{intl l='Online'}"
|
||||
}
|
||||
<th class="text-right">
|
||||
{admin_sortable_header
|
||||
current_order=$product_order
|
||||
order='min_price'
|
||||
reverse_order='max_price'
|
||||
path={url path='/admin/catalog' category_id=$category_id target='products'}
|
||||
request_parameter_name='product_order'
|
||||
label="{intl l='Price'}"
|
||||
}
|
||||
</th>
|
||||
|
||||
<th>
|
||||
<th class="text-center">
|
||||
{admin_sortable_header
|
||||
current_order=$product_order
|
||||
order='visible'
|
||||
reverse_order='visible_reverse'
|
||||
path={url path='/admin/catalog' category_id=$category_id target='products'}
|
||||
request_parameter_name='product_order'
|
||||
label="{intl l='Online'}"
|
||||
}
|
||||
</th>
|
||||
|
||||
<th class="text-center">
|
||||
{admin_sortable_header
|
||||
current_order=$product_order
|
||||
order='manual'
|
||||
reverse_order='manual_reverse'
|
||||
path={url path='/admin/categories' id_category=$category_id target='products'}
|
||||
path={url path='/admin/catalog' category_id=$category_id target='products'}
|
||||
request_parameter_name='product_order'
|
||||
label="{intl l='Position'}"
|
||||
}
|
||||
</th>
|
||||
@@ -280,6 +300,7 @@
|
||||
<img src="{$IMAGE_URL}" alt="{$TITLE}" />
|
||||
</a>
|
||||
{/loop}
|
||||
</td>
|
||||
|
||||
<td class="object-title"><a href="{url path='/admin/products/update' product_id=$ID page=$page}" title="{intl l='Edit this product'}">{$REF}</a></td>
|
||||
|
||||
@@ -287,7 +308,9 @@
|
||||
|
||||
{module_include location='product_list_row'}
|
||||
|
||||
<td>
|
||||
<td class="text-right"><a href="{url path='/admin/products/update' product_id=$ID page=$page current_tab='prices'}" title="{intl l='Edit Prices'}">{format_money number=$BEST_PRICE symbol=$currency_symbol}</a></td>
|
||||
|
||||
<td class="text-center">
|
||||
{loop type="auth" name="can_change" role="ADMIN" resource="admin.product" access="UPDATE"}
|
||||
<div class="make-switch switch-small productVisibleToggle" data-id="{$ID}" data-on="success" data-off="danger" data-on-label="<i class='glyphicon glyphicon-ok'></i>" data-off-label="<i class='glyphicon glyphicon-remove'></i>">
|
||||
<input type="checkbox" class="productVisibleToggle" {if $VISIBLE == 1}checked="checked"{/if}>
|
||||
@@ -301,7 +324,7 @@
|
||||
{/elseloop}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<td class="text-center">
|
||||
{admin_position_block
|
||||
resource="admin.product"
|
||||
access="UPDATE"
|
||||
@@ -329,13 +352,13 @@
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="6">
|
||||
<td colspan="9">
|
||||
{include
|
||||
file = "includes/pagination.html"
|
||||
|
||||
loop_ref = "product_list"
|
||||
max_page_count = 10
|
||||
page_url = "{url path="/admin/categories" category_id=$category_id product_order=$product_order}"
|
||||
page_url = "{url path="/admin/catalog" category_id=$category_id product_order=$product_order}"
|
||||
}
|
||||
|
||||
</td>
|
||||
@@ -794,10 +817,16 @@
|
||||
captureLength: 1,
|
||||
wait : 300,
|
||||
callback : function () {
|
||||
var price = $(this).val();
|
||||
$(this).val(sanitizeFloat(price));
|
||||
update_price($(this).val(), $(this).data('price-type'), $(this).data('rel-price'));
|
||||
}
|
||||
});
|
||||
|
||||
function sanitizeFloat(numVal) {
|
||||
return numVal.replace(",", ".");
|
||||
};
|
||||
|
||||
});
|
||||
</script>
|
||||
{/block}
|
||||
|
||||
@@ -242,9 +242,9 @@
|
||||
|
||||
{module_include location='product_details_promotion_form'}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</form>
|
||||
{/form}
|
||||
{/if}
|
||||
|
||||
@@ -454,6 +454,16 @@
|
||||
</table>
|
||||
|
||||
{module_include location='product_after_combinations'}
|
||||
|
||||
|
||||
{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}"
|
||||
}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -99,9 +99,15 @@
|
||||
{/if}
|
||||
<tr>
|
||||
<td>
|
||||
{loop type="product" name="my_product_loop" visible="*" ref="$REF"}
|
||||
<a href="{url path='/admin/products/update' product_id=$ID}">{$TITLE}</a>
|
||||
{/loop}
|
||||
{ifloop rel="my_product_loop"}
|
||||
{loop type="product" name="my_product_loop" visible="*" ref="$REF"}
|
||||
<a href="{url path='/admin/products/update' product_id=$ID}">{$TITLE}</a>
|
||||
{/loop}
|
||||
{/ifloop}
|
||||
{elseloop rel="my_product_loop"}
|
||||
{* The product doesn't exist anymore *}
|
||||
{$TITLE}
|
||||
{/elseloop}
|
||||
{ifloop rel="combinations"}
|
||||
<dl class="dl-horizontal">
|
||||
{loop type="order_product_attribute_combination" name="combinations" order_product=$ID}
|
||||
@@ -162,6 +168,32 @@
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
{loop type="order_address" name="order-invoice-address" id=$INVOICE_ADDRESS}
|
||||
{assign "orderInvoiceFirstName" $FIRSTNAME}
|
||||
{assign "orderInvoiceLastName" $LASTNAME}
|
||||
{assign "orderInvoiceCompany" $COMPANY}
|
||||
{/loop}
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-condensed table-left-aligned">
|
||||
<caption class="clearfix">
|
||||
{intl l='Customer information'}
|
||||
</caption>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>{intl l="Customer"}</th>
|
||||
<td><a href="{url path='/admin/customer/update' customer_id=$CUSTOMER}">{$orderInvoiceFirstName|ucwords} {$orderInvoiceLastName|upper}</a></td>
|
||||
</tr>
|
||||
{if $orderInvoiceCompany}
|
||||
<tr>
|
||||
<th>{intl l="Company"}</th>
|
||||
<td>{$orderInvoiceCompany}</td>
|
||||
</tr>
|
||||
{/if}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-condensed table-left-aligned">
|
||||
<caption class="clearfix">
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
<div class="col-md-12 general-block-decorator">
|
||||
<div class="row">
|
||||
<div class="col-md-7 title">
|
||||
{intl l='Edit product %title' title={$TITLE}}
|
||||
{intl l='Edit product %title' title={$TITLE}}{if $REF} ({intl l='ref.:'} {$REF}){/if}
|
||||
</div>
|
||||
|
||||
<div class="col-md-5 actions">
|
||||
@@ -363,10 +363,16 @@ $(function() {
|
||||
captureLength: 1,
|
||||
wait : 300,
|
||||
callback : function () {
|
||||
update_price($(this).val(), $(this).data('price-type'), $(this).data('rel-price'));
|
||||
var price = $(this).val();
|
||||
$(this).val(sanitizeFloat(price));
|
||||
update_price($(this).val(), $(this).data('price-type'), $(this).data('rel-price'));
|
||||
}
|
||||
});
|
||||
|
||||
function sanitizeFloat(numVal) {
|
||||
return numVal.replace(",", ".");
|
||||
};
|
||||
|
||||
// Count generated combinations in real time
|
||||
function countGeneratedCombinations() {
|
||||
|
||||
|
||||
@@ -223,7 +223,8 @@
|
||||
<li>
|
||||
<strong>{$TITLE}</strong> :
|
||||
{loop name="feature_value_info" type="feature_value" feature="{$ID}" product="{product attr="id"}"}
|
||||
{$TITLE}
|
||||
{if $LOOP_COUNT > 1}, {else} {/if}
|
||||
<span>{if $IS_FREE_TEXT == 1}{$FREE_TEXT_VALUE}{else}{$TITLE}{/if}</span>
|
||||
{/loop}
|
||||
</li>
|
||||
{/ifloop}
|
||||
|
||||
Reference in New Issue
Block a user