Jump to content

Categories on home page


Guest familychoice

Recommended Posts

Guest familychoice

Hi,

I've just upgraded from V4 to V5 and trying to replicate the previous custom template I'd built. On the V4 site I'd set the home page template to display top level categories using the following code:


<h2>Products</h2>

<div>

<!-- BEGIN: homepage_cats_loop -->

  <div class="homeCats">

  <a href="index.php?_a=viewCat&amp;catId={MODCAT.cat_id}" class="txtDefault"><img src="{IMG_CATEGORY}" alt="{MODCAT.cat_name}" border="0" title="{MODCAT.cat_name}" /></a><br />

  <a href="index.php?_a=viewCat&amp;catId={MODCAT.cat_id}" class="txtDefault">{MODCAT.cat_name}</a>

  </div>

<!-- END: homepage_cats_loop -->

The code above will no longer work, and will need to be modified. Does anyone know how I can get this code to work, or point me in the direction of some documentation that would help? I've searched various forums but come up blank so far, so any help very appreciated.

Thanks!

Link to comment
Share on other sites

This is not a feature of the core product, therefore your enquiries should be directed to the third-party forum. What you're asking for is support for a v4 mod that you are trying to install in v5. This won't work as v4 is completely different to v5. CubeCartForums.org is the place to go.

Link to comment
Share on other sites

Guest familychoice

This is not a feature of the core product, therefore your enquiries should be directed to the third-party forum. What you're asking for is support for a v4 mod that you are trying to install in v5. This won't work as v4 is completely different to v5. CubeCartForums.org is the place to go.

Ah right, didn't realise it was using a mod, thought it was scripted in. I did check the other forum though and didn't notice any plugins or updates to do this, I'll post there to see if anyone can provide an update though.

Is it not possible to code this directly into the homepage template though without using a mod?

Link to comment
Share on other sites

Is it not possible to code this directly into the homepage template though without using a mod?

The nature of changing the functionality of something from the standard code is a modification. This forum supports the core product only, the third-party forum supports customisation.
Link to comment
Share on other sites

Guest familychoice

I just want to display categories on the home page, which I thought would be a relatively straightforward template change.

If anyone can offer any tips I'd appreciate it.

Link to comment
Share on other sites

Guest Viola

The category names and links are in the standard category menu which is already displayed on every page. However the category images are not, which is where the mod comes in.

You could actually do this quite easily by just putting image links to your categories in the home page content. It wouldn't be dynamic that way, but unless you are planning to change around your categories every week that shouldn't be much of a problem.

Link to comment
Share on other sites

Guest familychoice

The category names and links are in the standard category menu which is already displayed on every page. However the category images are not, which is where the mod comes in.

You could actually do this quite easily by just putting image links to your categories in the home page content. It wouldn't be dynamic that way, but unless you are planning to change around your categories every week that shouldn't be much of a problem.

Thanks for the reply.

I've considered adding the images and links manually and this is an option, but ideally I'd like to find a way to dynamically generate the category images and titles as the client has a lot of categories and makes a lot of amendments to their site.

There's something similar to what I'm trying to achieve already there when you visit a category home page, as it displays the sub category thumbnails, titles and links. In the content.category.php file they've used the following:


<h2>{$category.cat_name}</h2>

{if isset($category.image)}

<div id="category_image"><img src="{$category.image}" alt="{$category.cat_name}" /></div>

{/if}

{$category.cat_desc}

{if isset($SUBCATS) && $SUBCATS}

<div id="subcategories">

  {foreach from=$SUBCATS item=subcat}

  <div class="subcategory">

<a href="{$subcat.url}" title="{$subcat.cat_name}">

   <img src="{$subcat.cat_image}" alt="{$subcat.cat_name}" />

</a>

<a href="{$subcat.url}" title="{$subcat.cat_name}">{$subcat.cat_name}</a>

  </div>

  {/foreach}

</div>

{/if}

I thought there might be a way to modify this for use in the homepage file, so that it picks up all parent/top level categories rather than sub-categories. I tried changing the references to subcats to categories but it didn't work.

Are there any documents available that provide reference for the tags and code they're using so I can get this to work?

Link to comment
Share on other sites

Guest Viola

Just changing the template isn't going to work. The values for the category image filenames have to be pulled out of the database and assigned to template variables. This all happens outside of the template. The variable "{$subcat.cat.image}" is only assigned a value when you load up a category page - that's why it won't work anywhere else. Hope that makes sense.

If you want to try and modify the code, it will be somewhere in the "classes" folder..... good luck. :D

As Robsta said, this is something for the 3rd-party mod forum.

Link to comment
Share on other sites

Guest familychoice

Just changing the template isn't going to work. The values for the category image filenames have to be pulled out of the database and assigned to template variables. This all happens outside of the template. The variable "{$subcat.cat.image}" is only assigned a value when you load up a category page - that's why it won't work anywhere else. Hope that makes sense.

If you want to try and modify the code, it will be somewhere in the "classes" folder..... good luck. :D

Thanks for the clarification Viola, it sounds like it's a bit more involved than I thought.

As Robsta said, this is something for the 3rd-party mod forum.

I try and avoid using too many mods if possible, as with this example, they can stop working after an upgrade or stop being supported. If I can get the store to work in the way I want it to by amending the template files then this is a preferable option and makes upgrading easier.

While I don't want to take custom from commercial mod developers, a bit of custom template help is always welcome, and in this case as far as I can tell there isn't a mod available for the job at present.

Link to comment
Share on other sites

Any changes you make to customise CubeCart is in the remit of the third-party forum. CubeCart have made it clear in the past that any customisations to CubeCart are not supported in this forum allowing them to concentrate on supporting the core product and code they created. The third-party forum is not just for those commercial developers, it's for any CubeCart customisation discussions.

Link to comment
Share on other sites

Guest familychoice

it's for any CubeCart customisation discussions.

Not much of a discussion happening yet.

If anyone on here can help I'd appreciate it.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...