Post by kliMa » Mon Jan 03, 2011 7:46 pm

Hi guys,

I'm just wondering how difficult is change a way to display a subcategories with products like on my example below.
What I'm looking for is to change way of display to following:

Afer click on main category you can see:

/subcategory name/
/products/ (only linked to this subcategory)

/subcategory name/
/products/ (only linked to this subcategory)

.....

/products/ describe:

quantity: 100, 200, 300, 400, .....
/product name/ price1, price2, price3, price4

I just use a modification form here http://forum.opencart.com/viewtopic.php?t=22723 so now when i click on main category, i will see subcategories with products.

Next what I wanna do is to add additional field to product [quantity] to display quantities but I dont have idea how to change a display system for that.

Can anybody help to do this ?

Two images. 1. What i actually got, 2 - after modification

Attachments

cart1_after.jpg

after modification - cart1_after.jpg (83.69 KiB) Viewed 1228 times

cart1.jpg

before, actually got - cart1.jpg (92.13 KiB) Viewed 1228 times


New member

Posts

Joined
Sat May 08, 2010 2:24 am
Location - London

Post by kliMa » Wed Jan 05, 2011 1:49 am

Hi guys,

is anyone who can HELP me with that ? I can offer to pay for that as I need it.
Well I think is not so complicated to someone to "deal" with opencart everyday, so I'm asking again how to change the way of display information.

Thank you

New member

Posts

Joined
Sat May 08, 2010 2:24 am
Location - London

User avatar
Active Member

Posts

Joined
Wed Mar 24, 2010 9:07 pm
Location - London

Post by kliMa » Wed Jan 05, 2011 6:26 am

Thank for tip Chones. I'm not finish to read it, but my main problem is to display info like this set:
[name of subcategory - products] .... [name of subcategory - products] when I click on category. There is a photo inluded "before, actually got" so first step is done, i see all subcategories and products but not this way what I want.

There is:
[category1] [category2] [category3]

[product1] [product1a] [product2] [product3]

should be:

[category1]
[product1] [product1a]
[category2]
[product2]
[category3]
[product3]

Any more TIPS how to separate sub/categories from products ? Well when Im finish it i will share with rest. This combination is good if you wanted to sell products and can compare prices on the same page from the choosen category.
Thank you

New member

Posts

Joined
Sat May 08, 2010 2:24 am
Location - London

Post by Chones » Wed Jan 05, 2011 2:20 pm

Well, the products that show up on the top-level category page are not necessarily related to the category - you choose which products show up - you can have none, one, or as many as you want. I think you can even have products not from the category.

What you want to do is list the sub-categories as normal, but also list all products in the sub-category as you do so. I don't have time to write that, but there is sort of a solution in the comments of one of my blog posts here:

http://craigmurray.me.uk/opencart-mods/ ... mment-1983

That should get you started. You'll just have to find the sub-category IDs and put them in the first line.

http://scarletandjones.com/
http://sharpdressedman.co.uk/
http://coffincompany.co.uk/
http://horsesculptures.co.uk/
If I've helped you out, why not buy me a beer? http://craigmurray.me.uk


User avatar
Active Member

Posts

Joined
Wed Mar 24, 2010 9:07 pm
Location - London

Post by kliMa » Thu Jan 06, 2011 2:55 am

Thank you Chones, this is the best tip for me, unfortunately still have a problem how to do this. Well I have no idea how to start to change some of the code (engine), but no problem to make font-end of it. Eh...

Below there is a code of category.tpl
You can see result on the image attached.

Code: Select all

<?php
$category_ids = array(36,37,38,40);        

foreach ($category_ids as $category_id) {
$category_info = $this->model_catalog_category->getCategory($category_id);
$products = $this->model_catalog_product->getProductsByCategoryId($category_id);

if($category_info > sizeof($products)) {
$trim = sizeof($products);
} else {
$trim = $limit;
}

if ($category_info) {
$heading_title = $category_info['name'];
}
?>
<!-- HTML Output for item list -->
<div class="recent_list">
<h1><?php echo $heading_title; ?></h1>
<ul class="items">
<?php
for ($i = 0; $i < $trim; $i++) {
$title = $products[$i]['name'];
$thumb = $this->model_tool_image->resize($products[$i]['image'], $this->config->get('config_image_product_width'), $this->config->get('config_image_product_height'));
$special = FALSE;
$discount = $this->model_catalog_product->getProductDiscount($products[$i]['product_id']);
if ($discount) {
$price = $this->currency->format($this->tax->calculate($discount, $products[$i]['tax_class_id'], $this->config->get('config_tax')));
} else {
$price = $this->currency->format($this->tax->calculate($products[$i]['price'], $products[$i]['tax_class_id'], $this->config->get('config_tax')));
$special = $this->model_catalog_product->getProductSpecial($products[$i]['product_id']);
if ($special) {
$special = $this->currency->format($this->tax->calculate($special, $products[$i]['tax_class_id'], $this->config->get('config_tax')));
}
}
$options = $this->model_catalog_product->getProductOptions($products[$i]['product_id']);
if ($options) {
$add = $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/product&product_id=' . $products[$i]['product_id']);
} else {
$add = HTTPS_SERVER . 'index.php?route=checkout/cart&product_id=' . $products[$i]['product_id'];
}
?>
<?php if($i % 4 == 0){ ?>
<li class="nospace">
<?php } else {?>
<li>
<?php }?>
<p class="price">
<?php echo $title; ?>
<?php if (!$special) { ?>
<?php echo $price; ?>
<?php } else { ?>
<span class="strike"><?php echo $price; ?></span> <?php echo $special; ?>
<?php } ?>
<a href="<?php echo $add; ?>">Add To Cart</a>
</p>
</li>
<?php } ?>
</ul>
</div>
<?php } ?>   
Main problem - I can see all subcategories, when I click on Magic boxes I can see Oval subcategory (Oval Cat 1).

The thing is that I have no idea how to change this $category_ids = array(36,37,38,40); to get subcategories only from parent category.

Any ideas ?
Thank you

Attachments

step2.jpg

result - step2.jpg (81.04 KiB) Viewed 1178 times


New member

Posts

Joined
Sat May 08, 2010 2:24 am
Location - London
Who is online

Users browsing this forum: No registered users and 20 guests