I've been searching the boards for some info on changing the default sort order for products in each category, I found some guides on older Opencart versions but they do not seem relevant to 1.4.8. Basically what I want to do is make everything sort by price (low to high) by default.
If anyone could help out that would be much appreciated.
Thanks,
Pat
Gym Equipment Online Store
http://www.wizardhomefitness.com.au
----------------------------------------------------
Fresh Kicks Online Sneaker & Clothing Store
http://www.freshkicks.com.au
If not you will have to go into the category controller and change the php to do that.
930sc ... because it is fun!
that would be awfully painful if you have many products in the store.SapporoGuy wrote:You can set the sort order with the admin on a per product basis.
i'm interested to know how too. but the codes for 1.4.8 and 1.4.9 are a tad different. I've tried this guide on sorting by latest http://forum.opencart.com/viewtopic.php ... 13#p118374, but to no avail.SapporoGuy wrote:If not you will have to go into the category controller and change the php to do that.
any help or advice, old wise one?
I don't know much about PHP...~~
Don't know much about JQuery...~~
But I do know that I love OC!~~
and I know that if you'd guide me, what a wonderful world this would be...!~~
_________________________________________________________________
Using OC 1.4.9.2
http://www.ten2hundred.com
change:
Code: Select all
if (isset($this->request->get['page'])) {
$page = $this->request->get['page'];
} else {
$page = 1;
}
if (isset($this->request->get['sort'])) {
$sort = $this->request->get['sort'];
} else {
$sort = 'p.sort_order';
}
if (isset($this->request->get['order'])) {
$order = $this->request->get['order'];
} else {
$order = 'ASC';
}
$url = '';
Code: Select all
if (isset($this->request->get['page'])) {
$page = $this->request->get['page'];
} else {
$page = 1;
}
if (isset($this->request->get['sort'])) {
$sort = $this->request->get['sort'];
} else {
// $sort = 'p.sort_order';
$sort = 'p.price';
}
if (isset($this->request->get['order'])) {
$order = $this->request->get['order'];
} else {
$order = 'ASC';
}
$url = '';
I haven't tried it but it should work.
930sc ... because it is fun!
it didn't help mate. Now the products got sorted by price. ^^ I tried changingSapporoGuy wrote:in controller/product/category.php
change:TO >>>>Code: Select all
if (isset($this->request->get['page'])) { $page = $this->request->get['page']; } else { $page = 1; } if (isset($this->request->get['sort'])) { $sort = $this->request->get['sort']; } else { $sort = 'p.sort_order'; } if (isset($this->request->get['order'])) { $order = $this->request->get['order']; } else { $order = 'ASC'; } $url = '';
Code: Select all
if (isset($this->request->get['page'])) { $page = $this->request->get['page']; } else { $page = 1; } if (isset($this->request->get['sort'])) { $sort = $this->request->get['sort']; } else { // $sort = 'p.sort_order'; $sort = 'p.price'; } if (isset($this->request->get['order'])) { $order = $this->request->get['order']; } else { $order = 'ASC'; } $url = '';
I haven't tried it but it should work.
p.price
to
p.date_available
but still same, it jumps back to sorting from old to new.
I don't know much about PHP...~~
Don't know much about JQuery...~~
But I do know that I love OC!~~
and I know that if you'd guide me, what a wonderful world this would be...!~~
_________________________________________________________________
Using OC 1.4.9.2
http://www.ten2hundred.com
Code: Select all
<?php
class ControllerProductCategory extends Controller {
public function index() {
$this->language->load('product/category');
$this->document->breadcrumbs = array();
$this->document->breadcrumbs[] = array(
'href' => HTTP_SERVER . 'index.php?route=common/home',
'text' => $this->language->get('text_home'),
'separator' => FALSE
);
$this->load->model('catalog/category');
$this->load->model('tool/seo_url');
if (isset($this->request->get['path'])) {
$path = '';
$parts = explode('_', $this->request->get['path']);
foreach ($parts as $path_id) {
$category_info = $this->model_catalog_category->getCategory($path_id);
if ($category_info) {
if (!$path) {
$path = $path_id;
} else {
$path .= '_' . $path_id;
}
$this->document->breadcrumbs[] = array(
'href' => $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/category&path=' . $path),
'text' => $category_info['name'],
'separator' => $this->language->get('text_separator')
);
}
}
$category_id = array_pop($parts);
} else {
$category_id = 0;
}
$category_info = $this->model_catalog_category->getCategory($category_id);
if ($category_info) {
$this->document->title = $category_info['name'];
$this->document->keywords = $category_info['meta_keywords'];
$this->document->description = $category_info['meta_description'];
$this->data['heading_title'] = $category_info['name'];
$this->data['description'] = html_entity_decode($category_info['description'], ENT_QUOTES, 'UTF-8');
$this->data['text_sort'] = $this->language->get('text_sort');
$this->load->model('tool/image');
if ($category_info['image']) {
$image = $category_info['image'];
} else {
$image = '';
}
$this->data['thumb'] = $this->model_tool_image->resize($image, $this->config->get('config_image_category_width'),
$this->config->get('config_image_category_height'));
if (isset($this->request->get['page'])) {
$page = $this->request->get['page'];
} else {
$page = 1;
}
if (isset($this->request->get['sort'])) {
$sort = $this->request->get['sort'];
} else {
$sort = 'p.price';
}
if (isset($this->request->get['order'])) {
$order = $this->request->get['order'];
} else {
$order = 'ASC';
}
$url = '';
if (isset($this->request->get['sort'])) {
$url .= '&sort=' . $this->request->get['sort'];
}
if (isset($this->request->get['order'])) {
$url .= '&order=' . $this->request->get['order'];
}
$this->load->model('catalog/product');
$category_total = $this->model_catalog_category->getTotalCategoriesByCategoryId($category_id);
$product_total = $this->model_catalog_product->getTotalProductsByCategoryId($category_id);
if ($category_total || $product_total) {
$this->data['categories'] = array();
$results = $this->model_catalog_category->getCategories($category_id);
foreach ($results as $result) {
if ($result['image']) {
$image = $result['image'];
} else {
$image = 'no_image.jpg';
}
$this->data['categories'][] = array(
'name' => $result['name'],
'href' => $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/category&path=' . $this->request->get['path'] . '_' . $result['category_id'] . $url),
'thumb' => $this->model_tool_image->resize($image, $this->config->get('config_image_category_width'), $this->config->get('config_image_category_height'))
);
}
$this->load->model('catalog/review');
$this->data['button_add_to_cart'] = $this->language->get('button_add_to_cart');
$this->data['products'] = array();
$results = $this->model_catalog_product->getProductsByCategoryId($category_id, $sort, $order, ($page - 1) * $this->config->get('config_catalog_limit'), $this->config->get('config_catalog_limit'));
foreach ($results as $result) {
if ($result['image']) {
$image = $result['image'];
} else {
$image = 'no_image.jpg';
}
if ($this->config->get('config_review')) {
$rating = $this->model_catalog_review->getAverageRating($result['product_id']);
} else {
$rating = false;
}
$special = FALSE;
$discount = $this->model_catalog_product->getProductDiscount($result['product_id']);
if ($discount) {
$price = $this->currency->format($this->tax->calculate($discount, $result['tax_class_id'], $this->config->get('config_tax')));
} else {
$price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')));
$special = $this->model_catalog_product->getProductSpecial($result['product_id']);
if ($special) {
$special = $this->currency->format($this->tax->calculate($special, $result['tax_class_id'], $this->config->get('config_tax')));
}
}
$options = $this->model_catalog_product->getProductOptions($result['product_id']);
if ($options) {
$add = $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/product&product_id=' . $result['product_id']);
} else {
$add = HTTPS_SERVER . 'index.php?route=checkout/cart&product_id=' . $result['product_id'];
}
$this->data['products'][] = array(
'name' => $result['name'],
'model' => $result['model'],
'rating' => $rating,
'stars' => sprintf($this->language->get('text_stars'), $rating),
'thumb' => $this->model_tool_image->resize($image, $this->config->get('config_image_product_width'), $this->config->get('config_image_product_height')),
'price' => $price,
'options' => $options,
'special' => $special,
'href' => $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/product&path=' . $this->request->get['path'] . '&product_id=' . $result['product_id']),
'add' => $add
);
}
if (!$this->config->get('config_customer_price')) {
$this->data['display_price'] = TRUE;
} elseif ($this->customer->isLogged()) {
$this->data['display_price'] = TRUE;
} else {
$this->data['display_price'] = FALSE;
}
$url = '';
if (isset($this->request->get['page'])) {
$url .= '&page=' . $this->request->get['page'];
}
$this->data['sorts'] = array();
$this->data['sorts'][] = array(
'text' => $this->language->get('text_default'),
'value' => 'p.sort_order-ASC',
'href' => $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/category&path=' . $this->request->get['path'] . '&sort=p.sort_order&order=ASC')
);
$this->data['sorts'][] = array(
'text' => $this->language->get('text_name_asc'),
'value' => 'pd.name-ASC',
'href' => $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/category&path=' . $this->request->get['path'] . '&sort=pd.name&order=ASC')
);
$this->data['sorts'][] = array(
'text' => $this->language->get('text_name_desc'),
'value' => 'pd.name-DESC',
'href' => $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/category&path=' . $this->request->get['path'] . '&sort=pd.name&order=DESC')
);
$this->data['sorts'][] = array(
'text' => $this->language->get('text_price_asc'),
'value' => 'p.price-ASC',
'href' => $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/category&path=' . $this->request->get['path'] . '&sort=p.price&order=ASC')
);
$this->data['sorts'][] = array(
'text' => $this->language->get('text_price_desc'),
'value' => 'p.price-DESC',
'href' => $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/category&path=' . $this->request->get['path'] . '&sort=p.price&order=DESC')
);
$this->data['sorts'][] = array(
'text' => $this->language->get('text_rating_desc'),
'value' => 'rating-DESC',
'href' => $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/category&path=' . $this->request->get['path'] . '&sort=rating&order=DESC')
);
$this->data['sorts'][] = array(
'text' => $this->language->get('text_rating_asc'),
'value' => 'rating-ASC',
'href' => $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/category&path=' . $this->request->get['path'] . '&sort=rating&order=ASC')
);
$this->data['sorts'][] = array(
'text' => $this->language->get('text_model_asc'),
'value' => 'p.model-ASC',
'href' => $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/category&path=' . $this->request->get['path'] . '&sort=p.model&order=ASC')
);
$this->data['sorts'][] = array(
'text' => $this->language->get('text_model_desc'),
'value' => 'p.model-DESC',
'href' => $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/category&path=' . $this->request->get['path'] . '&sort=p.model&order=DESC')
);
$url = '';
if (isset($this->request->get['sort'])) {
$url .= '&sort=' . $this->request->get['sort'];
}
if (isset($this->request->get['order'])) {
$url .= '&order=' . $this->request->get['order'];
}
$pagination = new Pagination();
$pagination->total = $product_total;
$pagination->page = $page;
$pagination->limit = $this->config->get('config_catalog_limit');
$pagination->text = $this->language->get('text_pagination');
$pagination->url = $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/category&path=' . $this->request->get['path'] . $url . '&page={page}');
$this->data['pagination'] = $pagination->render();
$this->data['sort'] = $sort;
$this->data['order'] = $order;
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/product/category.tpl')) {
$this->template = $this->config->get('config_template') . '/template/product/category.tpl';
} else {
$this->template = 'default/template/product/category.tpl';
}
$this->children = array(
'common/column_right',
'common/column_left',
'common/footer',
'common/header'
);
$this->response->setOutput($this->render(TRUE), $this->config->get('config_compression'));
} else {
$this->document->title = $category_info['name'];
$this->document->description = $category_info['meta_description'];
$this->data['heading_title'] = $category_info['name'];
$this->data['text_error'] = $this->language->get('text_empty');
$this->data['button_continue'] = $this->language->get('button_continue');
$this->data['continue'] = HTTP_SERVER . 'index.php?route=common/home';
$this->data['categories'] = array();
$this->data['products'] = array();
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/product/category.tpl')) {
$this->template = $this->config->get('config_template') . '/template/product/category.tpl';
} else {
$this->template = 'default/template/product/category.tpl';
}
$this->children = array(
'common/column_right',
'common/column_left',
'common/footer',
'common/header'
);
$this->response->setOutput($this->render(TRUE), $this->config->get('config_compression'));
}
} else {
$url = '';
if (isset($this->request->get['sort'])) {
$url .= '&sort=' . $this->request->get['sort'];
}
if (isset($this->request->get['order'])) {
$url .= '&order=' . $this->request->get['order'];
}
if (isset($this->request->get['page'])) {
$url .= '&page=' . $this->request->get['page'];
}
if (isset($this->request->get['path'])) {
$this->document->breadcrumbs[] = array(
'href' => $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/category&path=' . $this->request->get['path'] . $url),
'text' => $this->language->get('text_error'),
'separator' => $this->language->get('text_separator')
);
}
$this->document->title = $this->language->get('text_error');
$this->data['heading_title'] = $this->language->get('text_error');
$this->data['text_error'] = $this->language->get('text_error');
$this->data['button_continue'] = $this->language->get('button_continue');
$this->data['continue'] = HTTP_SERVER . 'index.php?route=common/home';
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/error/not_found.tpl')) {
$this->template = $this->config->get('config_template') . '/template/error/not_found.tpl';
} else {
$this->template = 'default/template/error/not_found.tpl';
}
$this->children = array(
'common/column_right',
'common/column_left',
'common/footer',
'common/header'
);
$this->response->setOutput($this->render(TRUE), $this->config->get('config_compression'));
}
}
}
?>
I don't know much about PHP...~~
Don't know much about JQuery...~~
But I do know that I love OC!~~
and I know that if you'd guide me, what a wonderful world this would be...!~~
_________________________________________________________________
Using OC 1.4.9.2
http://www.ten2hundred.com
Use p.date_available, and in the next block of code, changemanson wrote:it didn't help mate. Now the products got sorted by price. ^^ I tried changing
p.price
to
p.date_available
but still same, it jumps back to sorting from old to new.
Code: Select all
$order = 'ASC';
Code: Select all
$order = 'DESC';
Johnathan it seems took care of yours
930sc ... because it is fun!
I even cleared my browser's cache just in case. Same thing. The code doesn't change the sort order.
Did I did something wrong?
I don't know much about PHP...~~
Don't know much about JQuery...~~
But I do know that I love OC!~~
and I know that if you'd guide me, what a wonderful world this would be...!~~
_________________________________________________________________
Using OC 1.4.9.2
http://www.ten2hundred.com
I tested the p.price and DESC change, and it works for me. If it's not working for you, restore the default file from the original zip file, then try it again.
are we overlooking something here?
here's my whole code again, its the default file but i just changed $sort and $order.
Code: Select all
<?php
class ControllerProductCategory extends Controller {
public function index() {
$this->language->load('product/category');
$this->document->breadcrumbs = array();
$this->document->breadcrumbs[] = array(
'href' => HTTP_SERVER . 'index.php?route=common/home',
'text' => $this->language->get('text_home'),
'separator' => FALSE
);
$this->load->model('catalog/category');
$this->load->model('tool/seo_url');
if (isset($this->request->get['path'])) {
$path = '';
$parts = explode('_', $this->request->get['path']);
foreach ($parts as $path_id) {
$category_info = $this->model_catalog_category->getCategory($path_id);
if ($category_info) {
if (!$path) {
$path = $path_id;
} else {
$path .= '_' . $path_id;
}
$this->document->breadcrumbs[] = array(
'href' => $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/category&path=' . $path),
'text' => $category_info['name'],
'separator' => $this->language->get('text_separator')
);
}
}
$category_id = array_pop($parts);
} else {
$category_id = 0;
}
$category_info = $this->model_catalog_category->getCategory($category_id);
if ($category_info) {
$this->document->title = $category_info['name'];
$this->document->keywords = $category_info['meta_keywords'];
$this->document->description = $category_info['meta_description'];
$this->data['heading_title'] = $category_info['name'];
$this->data['description'] = html_entity_decode($category_info['description'], ENT_QUOTES, 'UTF-8');
$this->data['text_sort'] = $this->language->get('text_sort');
$this->load->model('tool/image');
if ($category_info['image']) {
$image = $category_info['image'];
} else {
$image = '';
}
$this->data['thumb'] = $this->model_tool_image->resize($image, $this->config->get('config_image_category_width'), $this->config->get('config_image_category_height'));
if (isset($this->request->get['page'])) {
$page = $this->request->get['page'];
} else {
$page = 1;
}
if (isset($this->request->get['sort'])) {
$sort = $this->request->get['sort'];
} else {
$sort = 'p.date_available';
}
if (isset($this->request->get['order'])) {
$order = $this->request->get['order'];
} else {
$order = 'DESC';
}
$url = '';
if (isset($this->request->get['sort'])) {
$url .= '&sort=' . $this->request->get['sort'];
}
if (isset($this->request->get['order'])) {
$url .= '&order=' . $this->request->get['order'];
}
$this->load->model('catalog/product');
$category_total = $this->model_catalog_category->getTotalCategoriesByCategoryId($category_id);
$product_total = $this->model_catalog_product->getTotalProductsByCategoryId($category_id);
if ($category_total || $product_total) {
$this->data['categories'] = array();
$results = $this->model_catalog_category->getCategories($category_id);
foreach ($results as $result) {
if ($result['image']) {
$image = $result['image'];
} else {
$image = 'no_image.jpg';
}
$this->data['categories'][] = array(
'name' => $result['name'],
'href' => $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/category&path=' . $this->request->get['path'] . '_' . $result['category_id'] . $url),
'thumb' => $this->model_tool_image->resize($image, $this->config->get('config_image_category_width'), $this->config->get('config_image_category_height'))
);
}
$this->load->model('catalog/review');
$this->data['button_add_to_cart'] = $this->language->get('button_add_to_cart');
$this->data['products'] = array();
$results = $this->model_catalog_product->getProductsByCategoryId($category_id, $sort, $order, ($page - 1) * $this->config->get('config_catalog_limit'), $this->config->get('config_catalog_limit'));
foreach ($results as $result) {
if ($result['image']) {
$image = $result['image'];
} else {
$image = 'no_image.jpg';
}
if ($this->config->get('config_review')) {
$rating = $this->model_catalog_review->getAverageRating($result['product_id']);
} else {
$rating = false;
}
$special = FALSE;
$discount = $this->model_catalog_product->getProductDiscount($result['product_id']);
if ($discount) {
$price = $this->currency->format($this->tax->calculate($discount, $result['tax_class_id'], $this->config->get('config_tax')));
} else {
$price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')));
$special = $this->model_catalog_product->getProductSpecial($result['product_id']);
if ($special) {
$special = $this->currency->format($this->tax->calculate($special, $result['tax_class_id'], $this->config->get('config_tax')));
}
}
$options = $this->model_catalog_product->getProductOptions($result['product_id']);
if ($options) {
$add = $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/product&product_id=' . $result['product_id']);
} else {
$add = HTTPS_SERVER . 'index.php?route=checkout/cart&product_id=' . $result['product_id'];
}
$this->data['products'][] = array(
'name' => $result['name'],
'model' => $result['model'],
'rating' => $rating,
'stars' => sprintf($this->language->get('text_stars'), $rating),
'thumb' => $this->model_tool_image->resize($image, $this->config->get('config_image_product_width'), $this->config->get('config_image_product_height')),
'price' => $price,
'options' => $options,
'special' => $special,
'href' => $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/product&path=' . $this->request->get['path'] . '&product_id=' . $result['product_id']),
'add' => $add
);
}
if (!$this->config->get('config_customer_price')) {
$this->data['display_price'] = TRUE;
} elseif ($this->customer->isLogged()) {
$this->data['display_price'] = TRUE;
} else {
$this->data['display_price'] = FALSE;
}
$url = '';
if (isset($this->request->get['page'])) {
$url .= '&page=' . $this->request->get['page'];
}
$this->data['sorts'] = array();
$this->data['sorts'][] = array(
'text' => $this->language->get('text_default'),
'value' => 'p.sort_order-ASC',
'href' => $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/category&path=' . $this->request->get['path'] . '&sort=p.sort_order&order=ASC')
);
$this->data['sorts'][] = array(
'text' => $this->language->get('text_name_asc'),
'value' => 'pd.name-ASC',
'href' => $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/category&path=' . $this->request->get['path'] . '&sort=pd.name&order=ASC')
);
$this->data['sorts'][] = array(
'text' => $this->language->get('text_name_desc'),
'value' => 'pd.name-DESC',
'href' => $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/category&path=' . $this->request->get['path'] . '&sort=pd.name&order=DESC')
);
$this->data['sorts'][] = array(
'text' => $this->language->get('text_price_asc'),
'value' => 'p.price-ASC',
'href' => $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/category&path=' . $this->request->get['path'] . '&sort=p.price&order=ASC')
);
$this->data['sorts'][] = array(
'text' => $this->language->get('text_price_desc'),
'value' => 'p.price-DESC',
'href' => $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/category&path=' . $this->request->get['path'] . '&sort=p.price&order=DESC')
);
$this->data['sorts'][] = array(
'text' => $this->language->get('text_rating_desc'),
'value' => 'rating-DESC',
'href' => $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/category&path=' . $this->request->get['path'] . '&sort=rating&order=DESC')
);
$this->data['sorts'][] = array(
'text' => $this->language->get('text_rating_asc'),
'value' => 'rating-ASC',
'href' => $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/category&path=' . $this->request->get['path'] . '&sort=rating&order=ASC')
);
$this->data['sorts'][] = array(
'text' => $this->language->get('text_model_asc'),
'value' => 'p.model-ASC',
'href' => $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/category&path=' . $this->request->get['path'] . '&sort=p.model&order=ASC')
);
$this->data['sorts'][] = array(
'text' => $this->language->get('text_model_desc'),
'value' => 'p.model-DESC',
'href' => $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/category&path=' . $this->request->get['path'] . '&sort=p.model&order=DESC')
);
$url = '';
if (isset($this->request->get['sort'])) {
$url .= '&sort=' . $this->request->get['sort'];
}
if (isset($this->request->get['order'])) {
$url .= '&order=' . $this->request->get['order'];
}
$pagination = new Pagination();
$pagination->total = $product_total;
$pagination->page = $page;
$pagination->limit = $this->config->get('config_catalog_limit');
$pagination->text = $this->language->get('text_pagination');
$pagination->url = $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/category&path=' . $this->request->get['path'] . $url . '&page={page}');
$this->data['pagination'] = $pagination->render();
$this->data['sort'] = $sort;
$this->data['order'] = $order;
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/product/category.tpl')) {
$this->template = $this->config->get('config_template') . '/template/product/category.tpl';
} else {
$this->template = 'default/template/product/category.tpl';
}
$this->children = array(
'common/column_right',
'common/column_left',
'common/footer',
'common/header'
);
$this->response->setOutput($this->render(TRUE), $this->config->get('config_compression'));
} else {
$this->document->title = $category_info['name'];
$this->document->description = $category_info['meta_description'];
$this->data['heading_title'] = $category_info['name'];
$this->data['text_error'] = $this->language->get('text_empty');
$this->data['button_continue'] = $this->language->get('button_continue');
$this->data['continue'] = HTTP_SERVER . 'index.php?route=common/home';
$this->data['categories'] = array();
$this->data['products'] = array();
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/product/category.tpl')) {
$this->template = $this->config->get('config_template') . '/template/product/category.tpl';
} else {
$this->template = 'default/template/product/category.tpl';
}
$this->children = array(
'common/column_right',
'common/column_left',
'common/footer',
'common/header'
);
$this->response->setOutput($this->render(TRUE), $this->config->get('config_compression'));
}
} else {
$url = '';
if (isset($this->request->get['sort'])) {
$url .= '&sort=' . $this->request->get['sort'];
}
if (isset($this->request->get['order'])) {
$url .= '&order=' . $this->request->get['order'];
}
if (isset($this->request->get['page'])) {
$url .= '&page=' . $this->request->get['page'];
}
if (isset($this->request->get['path'])) {
$this->document->breadcrumbs[] = array(
'href' => $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/category&path=' . $this->request->get['path'] . $url),
'text' => $this->language->get('text_error'),
'separator' => $this->language->get('text_separator')
);
}
$this->document->title = $this->language->get('text_error');
$this->data['heading_title'] = $this->language->get('text_error');
$this->data['text_error'] = $this->language->get('text_error');
$this->data['button_continue'] = $this->language->get('button_continue');
$this->data['continue'] = HTTP_SERVER . 'index.php?route=common/home';
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/error/not_found.tpl')) {
$this->template = $this->config->get('config_template') . '/template/error/not_found.tpl';
} else {
$this->template = 'default/template/error/not_found.tpl';
}
$this->children = array(
'common/column_right',
'common/column_left',
'common/footer',
'common/header'
);
$this->response->setOutput($this->render(TRUE), $this->config->get('config_compression'));
}
}
}
?>
I don't know much about PHP...~~
Don't know much about JQuery...~~
But I do know that I love OC!~~
and I know that if you'd guide me, what a wonderful world this would be...!~~
_________________________________________________________________
Using OC 1.4.9.2
http://www.ten2hundred.com
Works for me with the default database set. Makes no difference ASC or DESC though ... defaults to ID when dates are the same.
Did you make a change in a template or somewhere else?
930sc ... because it is fun!
IN:
Code: Select all
/catalog/model/catalog/product.php
Code: Select all
getProductsByCategoryId
Code: Select all
$sort_data = array(
Code: Select all
'p.date_available',
This has been troubling me since day 1 and finally its sorted out! LOVE YOU GUYS!~~ HUGS ALL AROUND! WEEE~~
I don't know much about PHP...~~
Don't know much about JQuery...~~
But I do know that I love OC!~~
and I know that if you'd guide me, what a wonderful world this would be...!~~
_________________________________________________________________
Using OC 1.4.9.2
http://www.ten2hundred.com
Gym Equipment Online Store
http://www.wizardhomefitness.com.au
----------------------------------------------------
Fresh Kicks Online Sneaker & Clothing Store
http://www.freshkicks.com.au
2.) instead of 'p.date_available',use 'pd.name',
Once, again, not tested but should work.
930sc ... because it is fun!
Actually, it's 'p.name'. I did it on my sight and it works great.SapporoGuy wrote:instead of 'p.date_available',use 'pd.name'
Marc
OpenCart v1.4.9.4
VQMod | Categories Home | Cleaner By Default - 2 Column | Speak Good English
I just checked my mysql db and didn't see "name" in the "products" table but saw it in the "products_description" table and just assumed that the sql query would follow other statements within the code and use "pd" instead of "p".
hmmmmm
930sc ... because it is fun!
Users browsing this forum: Google [Bot] and 7 guests