Page 1 of 1
View option in category
Posted: Sat Feb 13, 2010 7:25 pm
by johnjj
I want to show the newely added products at the back, not in the front. How can i do it.
Also i want to show the view '50' '100' option in the category page.
Please help me.
Thank you.
Re: View option in category
Posted: Sat Feb 13, 2010 9:28 pm
by Qphoria
1. EDIT: catalog/model/catalog/product.php
2. FIND:
Code: Select all
ORDER BY p.date_added DESC LIMIT " . (int)$limit);
3. REPLACE WITH:
Code: Select all
ORDER BY p.date_added ASC LIMIT " . (int)$limit);
Re: View option in category
Posted: Sun Feb 14, 2010 1:30 am
by johnjj
Hello.
Thanks a lot for your help. Please also help me add a sort view by "50" & "100" option in the category page. I tried modifying the module I found which displays all the product didn't work out
Thanks a lot. Appreciate your support a lot.
Re: View option in category
Posted: Mon Feb 15, 2010 3:12 am
by johnjj
Hi
Tried getting the values through sessions, it worked but i have to refresh the page twice, then it displays correctly.
Any idea? Please help me
Re: View option in category
Posted: Tue Feb 16, 2010 9:53 am
by b0lty
Interesting. I'm after the same thing with the options. Need to display them on the category page.
I figure you need to update category.php within the controller/product directory as well as category.tpl in the within the template/product directory.
If you look at the product.php within controller you'll see it has these lines...
Code: Select all
$this->data['options'] = array();
$options = $this->model_catalog_product->getProductOptions($this->request->get['product_id']);
foreach ($options as $option) {
$option_value_data = array();
foreach ($option['option_value'] as $option_value) {
$option_value_data[] = array(
'option_value_id' => $option_value['product_option_value_id'],
'name' => $option_value['name'],
'price' => (float)$option_value['price'] ? $this->currency->format($this->tax->calculate($option_value['price'], $product_info['tax_class_id'], $this->config->get('config_tax'))) : FALSE,
'prefix' => $option_value['prefix']
);
}
$this->data['options'][] = array(
'option_id' => $option['product_option_id'],
'name' => $option['name'],
'option_value' => $option_value_data
);
}
I guess this is defining how the options data will be stored for the category page (???). So this somehow needs to go within the category.php file within the controller directory but my coding abilities are not enoguh to figure how you'd do it correctly.
Once that's been done I'm guessing you'd then need to add something like this (as taken from product.tpl) to the template/product/category.tpl:
Code: Select all
<?php if ($options) { ?>
<b><?php echo $text_options; ?></b><br />
<div style="background: #F7F7F7; border: 1px solid #DDDDDD; padding: 10px; margin-top: 2px; margin-bottom: 15px;">
<table style="width: 100%;">
<?php foreach ($options as $option) { ?>
<tr>
<td><?php echo $option['name']; ?>:
<select name="option[<?php echo $option['option_id']; ?>]">
<?php foreach ($option['option_value'] as $option_value) { ?>
<option value="<?php echo $option_value['option_value_id']; ?>"><?php echo $option_value['name']; ?>
<?php if ($option_value['price']) { ?>
<?php echo $option_value['prefix']; ?><?php echo $option_value['price']; ?>
<?php } ?>
</option>
<?php } ?>
</select></td>
</tr>
<?php } ?>
</table>
</div>
<?php } ?>
Like I say, I don't really know what I'm doing beyond this, so if someone can help it'd be really really appreciated.