Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/origin/release-7.002.1.2-RC1'
Browse files Browse the repository at this point in the history
  • Loading branch information
datazen committed Mar 4, 2014
2 parents 311bfd4 + fe056fa commit 3f8f663
Show file tree
Hide file tree
Showing 9 changed files with 321 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function (data) {
' </p>'+
' <p class="button-height inline-label">'+
' <label for="image" class="label"><?php echo $lC_Language->get('field_image'); ?></label>'+
' <?php echo lc_draw_file_field('image', true, 'id="editImage" class="file"') . ' ' . $lC_Language->get('field_image_local') . '<br />' . realpath('../images/banners/') . '/' . lc_draw_input_field('image_local', null, 'id="editImageLocal" class="input" style="width:93%;"'); ?>'+
' <?php echo lc_draw_file_field('image', true, 'id="editImage" class="file" onchange="javascript:emptyImage();"') . ' ' . $lC_Language->get('field_image_local') . '<br />' . realpath('../images/banners/') . '/' . lc_draw_input_field('image_local', null, 'id="editImageLocal" class="input" style="width:93%;"'); ?>'+
' </p>'+
' <p class="button-height inline-label">'+
' <label for="address_format" class="label"><?php echo $lC_Language->get('field_image_target'); ?></label>'+
Expand Down Expand Up @@ -166,4 +166,8 @@ classes: 'blue-gradient glossy',
}
);
}

function emptyImage() {
$("#editImageLocal").val("");
}
</script>
117 changes: 94 additions & 23 deletions catalog/admin/includes/applications/products/classes/products.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,42 @@ public static function getAll($category_id = null) {
}

$lC_Language->loadIniFile('products.php');

$media = $_GET['media'];

$result = array('aaData' => array());

/* Total Records */
$QresultTotal = $lC_Database->query('SELECT count(p.products_id) as total from :table_products p where p.parent_id = 0');
$QresultTotal->bindTable(':table_products', TABLE_PRODUCTS);
$QresultTotal->execute();
$result['iTotalRecords'] = $QresultTotal->valueInt('total');
$QresultTotal->freeResult();

/* Paging */
$sLimit = "";
if (isset($_GET['iDisplayStart'])) {
if ($_GET['iDisplayLength'] != -1) {
$sLimit = " LIMIT " . $_GET['iDisplayStart'] . ", " . $_GET['iDisplayLength'];
}
}

/* Ordering */
if (isset($_GET['iSortCol_0'])) {
$sOrder = " ORDER BY ";
for ($i=0 ; $i < (int)$_GET['iSortingCols'] ; $i++ ) {
$sOrder .= lC_Products_Admin::fnColumnToField($_GET['iSortCol_'.$i] ) . " " . $_GET['sSortDir_'.$i] .", ";
}
$sOrder = substr_replace( $sOrder, "", -2 );
}

/* Filtering */
$sWhere = " WHERE p.parent_id = 0 ";
if ($_GET['sSearch'] != "") {
$sWhere .= " and pd.products_name LIKE '%" . $_GET['sSearch'] . "%'";
}

/* Main Listing Query */
if ( $category_id > 0 ) {
$lC_CategoryTree = new lC_CategoryTree_Admin();
$lC_CategoryTree->setBreadcrumbUsage(false);
Expand All @@ -51,43 +82,62 @@ public static function getAll($category_id = null) {
foreach ( $lC_CategoryTree->getArray($category_id) as $category ) {
$in_categories[] = $category['id'];
}

$Qproducts = $lC_Database->query('select SQL_CALC_FOUND_ROWS distinct p.*, pd.products_name, pd.products_keyword from :table_products p, :table_products_description pd, :table_products_to_categories p2c where p.parent_id = 0 and p.products_id = pd.products_id and pd.language_id = :language_id and p.products_id = p2c.products_id and p2c.categories_id in (:categories_id)');

/* Total Filtered Records */
$QresultFilterTotal = $lC_Database->query('SELECT count(p.products_id) as total, pd.products_name from :table_products p LEFT JOIN :table_products_description pd on (pd.products_id = p.products_id and pd.language_id = :language_id) LEFT JOIN :table_products_to_categories p2c on (p.products_id = p2c.products_id)' . $sWhere . ' and p2c.categories_id in (:categories_id) ' . $sOrder);
// $QresultFilterTotal = $lC_Database->query("SELECT count(p.products_id) as total, pd.products_name from :table_products p LEFT JOIN :table_products_description pd on (pd.products_id = p.products_id and pd.language_id = :language_id) " . $sWhere . ' and p2c.categories_id in (:categories_id) ' . $sOrder);
$QresultFilterTotal->bindTable(':table_products', TABLE_PRODUCTS);
$QresultFilterTotal->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION);
$QresultFilterTotal->bindTable(':table_products_to_categories', TABLE_PRODUCTS_TO_CATEGORIES);
$QresultFilterTotal->bindInt(':language_id', $lC_Language->getID());
$QresultFilterTotal->bindRaw(':categories_id', implode(',', $in_categories));
$QresultFilterTotal->execute();
$result['iTotalDisplayRecords'] = $QresultFilterTotal->valueInt('total');
$QresultFilterTotal->freeResult();

$Qproducts = $lC_Database->query('SELECT p.*, pd.products_name, pd.products_keyword from :table_products p LEFT JOIN :table_products_description pd on (p.products_id = pd.products_id and pd.language_id = :language_id) LEFT JOIN :table_products_to_categories p2c on (p.products_id = p2c.products_id)' . $sWhere . ' and p2c.categories_id in (:categories_id) ' . $sOrder . $sLimit);
$Qproducts->bindTable(':table_products_to_categories', TABLE_PRODUCTS_TO_CATEGORIES);
$Qproducts->bindRaw(':categories_id', implode(',', $in_categories));
} else {
$Qproducts = $lC_Database->query('select SQL_CALC_FOUND_ROWS p.*, pd.products_name, pd.products_keyword from :table_products p, :table_products_description pd where p.parent_id = 0 and p.products_id = pd.products_id and pd.language_id = :language_id');
/* Total Filtered Records */
$QresultFilterTotal = $lC_Database->query("SELECT count(p.products_id) as total, pd.products_name from :table_products p LEFT JOIN :table_products_description pd on (pd.products_id = p.products_id and pd.language_id = :language_id) " . $sWhere . $sOrder);
$QresultFilterTotal->bindTable(':table_products', TABLE_PRODUCTS);
$QresultFilterTotal->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION);
$QresultFilterTotal->bindInt(':language_id', $lC_Language->getID());
$QresultFilterTotal->execute();
$result['iTotalDisplayRecords'] = $QresultFilterTotal->valueInt('total');
$QresultFilterTotal->freeResult();

$Qproducts = $lC_Database->query('SELECT p.*, pd.products_name, pd.products_keyword from :table_products p LEFT JOIN :table_products_description pd on (p.products_id = pd.products_id and pd.language_id = :language_id) ' . $sWhere . $sOrder . $sLimit);
}

$Qproducts->appendQuery('order by pd.products_name');

$Qproducts->bindTable(':table_products', TABLE_PRODUCTS);
$Qproducts->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION);
$Qproducts->bindInt(':language_id', $lC_Language->getID());

$Qproducts->execute();

while ( $Qproducts->next() ) {
$Qproductscategories = $lC_Database->query('select p2c.categories_id, cd.categories_name, c.categories_status from :table_products_to_categories p2c left join :table_categories c on (p2c.categories_id = c.categories_id) left join lc_categories_description cd on (p2c.categories_id = cd.categories_id) where p2c.products_id = :products_id');
$Qproductscategories = $lC_Database->query('select p2c.categories_id, cd.categories_name, c.categories_status from :table_products_to_categories p2c left join :table_categories c on (p2c.categories_id = c.categories_id) left join lc_categories_description cd on (p2c.categories_id = cd.categories_id) where p2c.products_id = :products_id and cd.language_id = :language_id');
$Qproductscategories->bindTable(':table_categories', TABLE_CATEGORIES);
$Qproductscategories->bindTable(':table_categories_description', TABLE_CATEGORIES_DESCRIPTION);
$Qproductscategories->bindTable(':table_products_to_categories', TABLE_PRODUCTS_TO_CATEGORIES);
$Qproductscategories->bindRaw(':products_id', $Qproducts->valueInt('products_id'));

$Qproductscategories->bindInt(':language_id', $lC_Language->getID());
$Qproductscategories->execute();

$catCount = ($Qproductscategories->numberOfRows()-1);
while ( $Qproductscategories->next() ) {
$Qcategories[] = array('name' => $Qproductscategories->value('categories_name'),
'status' => $Qproductscategories->valueInt('categories_status'));
}
$cnt = 0;
$catArr = (is_array($Qcategories)) ? $Qcategories : array();

foreach ($catArr as $cat) {
if ($cnt == 0) {
$categories = '<small class="tag mid-margin-right glossy ' . (($cat['status'] == 1) ? ' green-gradient' : ' red-gradient') . '">' . $cat['name'] . '</small>';
}
if ($cnt == 1) {
$more_title = $cat['name'];
$categories .= '<small class="tag mid-margin-right glossy green-gradient with-tooltip" title="' . $catCount . ' ' . (($catCount > 1) ? $lC_Language->get('text_more_categories') : $lC_Language->get('text_more_category')) . '">...</small>';
$categories .= '<small title="' . $cat['name'] . '" class="with-tooltip cursor-pointer no-wrap tag mid-margin-right glossy ' . (($cat['status'] == 1) ? ' green-gradient' : ' red-gradient') . '">' . ((strlen($cat['name']) < 15) ? $cat['name'] : trim(substr($cat['name'], 0, 12)) . '...') . '</small>';
if ($cnt > 2) {
$categories .= '<br />';
$cnt = 0;
}
$cnt++;
}
Expand Down Expand Up @@ -135,11 +185,11 @@ public static function getAll($category_id = null) {
$products_status = ($Qvariants->valueInt('products_status') === 1);
$products_quantity = '(' . $Qvariants->valueInt('total_quantity') . ')';

$price = $lC_Currencies->format($Qvariants->value('min_price'));

$price = $lC_Currencies->format($Qvariants->value('min_price'), DECIMAL_PLACES);
if ( $Qvariants->value('min_price') != $Qvariants->value('max_price') ) {
$price .= ' - ' . $lC_Currencies->format($Qvariants->value('max_price'));
}

$icons .= '<span class="icon-flow-tree icon-blue mid-margin-right with-tooltip" style="cursor:pointer;" title="' . $lC_Language->get('text_has_variants') . '"></span>';
} else if ( self::hasSubProducts($Qproducts->valueInt('products_id')) === true ) {
$icons .= '<span class="icon-flow-cascade icon-red mid-margin-right with-tooltip" style="cursor:pointer;" title="' . $lC_Language->get('text_has_subproducts') . '"></span>';
Expand All @@ -151,7 +201,7 @@ public static function getAll($category_id = null) {
$Qspecials->execute();

if ($Qspecials->numberOfRows() > 0) {
$price = $price . ' <span class="tag glossy with-tooltip' . (($Qspecials->valueInt('status') == 1) ? ' red-gradient' : ' grey-gradient') . '" title="' . (($Qspecials->valueInt('status') == 1) ? $lC_Language->get('text_special_enabled') : $lC_Language->get('text_special_disabled')) . '">' . $Qspecials->value('specials_new_products_price') . '</span>';
$price = $price . ' <span class="tag glossy with-tooltip cursor-pointer' . (($Qspecials->valueInt('status') == 1) ? ' red-gradient' : ' grey-gradient') . '" title="' . (($Qspecials->valueInt('status') == 1) ? $lC_Language->get('text_special_enabled') : $lC_Language->get('text_special_disabled')) . '">' . $lC_Currencies->format($Qspecials->value('specials_new_products_price'), DECIMAL_PLACES) . '</span>';
}

$extra_data = array('products_cost_formatted' => $cost,
Expand All @@ -167,7 +217,7 @@ public static function getAll($category_id = null) {
$cats = '<td>' . $categories . '</td>';
$categories = null;
$class = '<td>' . $lC_Language->get('text_common') . '</td>';
$price = '<td>' . $price . '</td>';
$price = '<td><div class="no-wrap">' . $price . '</div></td>';
$qty = '<td>' . $products_quantity . '</td>';
$status = '<td><span class="align-center" id="status_' . $Qproducts->valueInt('products_id') . '" onclick="updateStatus(\'' . $Qproducts->valueInt('products_id') . '\', \'' . (($Qproducts->valueInt('products_status') == 1) ? 0 : 1) . '\');">' . (($Qproducts->valueInt('products_status') == 1) ? '<span class="icon-tick icon-size2 icon-green cursor-pointer with-tooltip" title="' . $lC_Language->get('text_disable_product') . '"></span>' : '<span class="icon-cross icon-size2 icon-red cursor-pointer with-tooltip" title="' . $lC_Language->get('text_enable_product') . '"></span>') . '</span></td>';

Expand All @@ -188,6 +238,7 @@ public static function getAll($category_id = null) {
$Qimage->freeResult();
$Qspecials->freeResult();
}
$result['sEcho'] = intval($_GET['sEcho']);

$Qproducts->freeResult();

Expand Down Expand Up @@ -732,9 +783,10 @@ public static function save($id = null, $data) {
$cPath = ($category_id != '') ? $lC_CategoryTree->getcPath($category_id) : 0;
}
foreach ($lC_Language->getAll() as $l) {
if (self::validatePermalink($data['products_keyword'][$l['id']], $id, 2) != 1) {
$data['products_keyword'][$l['id']] = $data['products_keyword'][$l['id']] . '-link';
}
// this code will be revisited
// if (self::validatePermalink($data['products_keyword'][$l['id']], $id, 2) != 1) {
// $data['products_keyword'][$l['id']] = $data['products_keyword'][$l['id']] . '-link';
// }

if (is_numeric($id)) {
$Qpd = $lC_Database->query('update :table_products_description set products_name = :products_name, products_description = :products_description, products_keyword = :products_keyword, products_tags = :products_tags, products_url = :products_url where products_id = :products_id and language_id = :language_id');
Expand Down Expand Up @@ -2362,5 +2414,24 @@ public static function getProductsDropdownArray($exclude = array()) {
}
return $result;
}
/*
* Return the field name for the selected column (used for datatable ordering)
*
* @param integer $i The datatable column id
* @access private
* @return string
*/
private static function fnColumnToField($i) {
if ( $i == 0 )
return "pd.products_name";
else if ( $i == 1 )
return "pd.products_name";
else if ( $i == 4 )
return "p.products_price";
else if ( $i == 5 )
return "p.products_quantity";
else if ( $i == 6 )
return "p.products_status";
}
}
?>
12 changes: 7 additions & 5 deletions catalog/admin/includes/applications/products/js/products.js.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,10 @@
?>
$("#products_name_<?php echo $l['id']; ?>").blur(function(){
var prodPermLink = $("#products_name_<?php echo $l['id']; ?>").val().toLowerCase().replace(/ /g, '-').replace(/[^a-z0-9-]/g, '').replace(/---/g, '-').replace(/--/g, '-');
//if (prodPermLink.match(/product$/i)) {
// prodPermLink = prodPermLink + '-link';
//}
// this code will be revisited
// if (prodPermLink.match(/product$/i)) {
// prodPermLink = prodPermLink + '-link';
// }
$("#products_keyword_<?php echo $l['id']; ?>").val(prodPermLink).focus();
validatePermalink($("#products_keyword_<?php echo $l['id']; ?>").val());
});
Expand Down Expand Up @@ -712,6 +713,7 @@ function (data) {
}
oTable = $('#dataTable').dataTable({
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": dataTableDataURL.replace('CID', cid).replace('MEDIA', $.template.mediaQuery.name),
"sPaginationType": paginationType,
"aLengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],
Expand All @@ -724,8 +726,8 @@ function (data) {
{ "sWidth": "10%", "bSortable": false, "sClass": "dataColCats hide-on-tablet" },
{ "sWidth": "10%", "bSortable": false, "sClass": "dataColClass hide-on-tablet" },
{ "sWidth": "10%", "bSortable": true, "sClass": "dataColPrice hide-on-mobile-portrait" },
{ "sWidth": "5%", "bSortable": false, "sClass": "dataColQty hide-on-mobile" },
{ "sWidth": "5%", "bSortable": false, "sClass": "dataColStatus hide-on-mobile" },
{ "sWidth": "5%", "bSortable": true, "sClass": "dataColQty hide-on-mobile" },
{ "sWidth": "5%", "bSortable": true, "sClass": "dataColStatus hide-on-mobile" },
{ "sWidth": "30%", "bSortable": false, "sClass": "dataColAction no-wrap" }]
});
$('#dataTable').responsiveTable();
Expand Down
23 changes: 23 additions & 0 deletions catalog/admin/includes/applications/products/js/responsive.js.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php
/**
@package catalog::admin::applications
@author Loaded Commerce
@copyright Copyright 2003-2014 Loaded Commerce, LLC
@copyright Portions Copyright 2003 osCommerce
@copyright Template built on Developr theme by DisplayInline http://themeforest.net/user/displayinline under Extended license
@license https://github.com/loadedcommerce/loaded7/blob/master/LICENSE.txt
@version $Id: responsive.js.php v1.0 2013-08-08 datazen $
*/
?>
<script>
// responsive functions
$(document).on('init-queries', function() {
if ($.template.mediaQuery.isSmallerThan('mobile-landscape')) { // mobile-portrait
$('.hide-on-mobile-portrait').hide();
}
}).on('enter-query-mobile-landscape', function() {
$('.hide-on-mobile-portrait').show();
}).on('quit-query-mobile-landscape', function() {
$('.hide-on-mobile-portrait').hide();
});
</script>
6 changes: 3 additions & 3 deletions catalog/admin/includes/templates/core.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@
*/
class lC_Template_core {
var $_id,
$_title = 'Bootstrap 3.0 Core Template',
$_title = 'Bootstrap 3.1.1 Core Template',
$_code = 'core',
$_author_name = 'Loaded Commerce, LLC',
$_author_www = 'http://www.loadedcommerce.com',
$_markup_version = 'HTML5/CSS3',
$_css_based = '1', /* 0=No; 1=Yes */
$_medium = 'Mobile Responsive UI',
$_screenshot = 'core.png',
$_version = '1.5.0',
$_compatibility = '7.002.1.0',
$_version = '1.0.6',
$_compatibility = '7.002.2.0',
$_groups = array('boxes' => array('left', 'right'),
'content' => array('header', 'before', 'after', 'footer')),
$_keys;
Expand Down
Loading

0 comments on commit 3f8f663

Please sign in to comment.