Jump to content

[RESOLVED] Replace 'Latest' on 'Featured' at the main page?


Recommended Posts

I tried swapping the code in content.homepage.php that creates the Latest Product section with the comparable code in box.featured.php, but it didn't work. I'm sure it can be done, but not by me. Sorry.

Please add your skin to your signature, and if you upgrade CC be sure to change that, too. Thanks for making one!! It saves time.

IF you're not dealing with a large number of products, you could disable Latest on all of them, enable Featured on all you want, and then use the Language setting in Admin to change the wording of Latest Products to what you want. That has the advantage that it will not make any core edits and will not be lost on upgrade.

Link to comment
Share on other sites

If we want to promote any particular products, then we do what DB has suggested.

rather than using 'Latest Products' to display the latest products, we use it to display products that we wish to promote.

In the languages section change the wording of 'Latest Products' to 'Anything You want'

Then anything you wish to display in this area just ensure the 'Include in latest products' check box ticked.

Edited by keat
Link to comment
Share on other sites

2 hours ago, Dirty Butter said:

Yes, I just re-read my suggestion and realized it didn't make sense. Take Latest off any you don't want to Feature. Then change the wording for Latest.

 

6 hours ago, keat said:

If we want to promote any particular products, then we do what DB has suggested.

rather than using 'Latest Products' to display the latest products, we use it to display products that we wish to promote.

In the languages section change the wording of 'Lastest Products' to 'Anything You want'

Then anything you wish to display in this area just ensure the 'Include in latest products' check box ticked.

Thank you for advice, I almost complete this way of realization my idea. However, there is one huge difference between these two lists which I wanted to use - the feature list isn't stable, it changes randomly. 

Link to comment
Share on other sites

I used this in 6.0.10 for a while, it may still work in later versions.

 

in classes/cubecart.class.php

change

$GLOBALS['smarty']->assign('LATEST_PRODUCTS', $products);

To:


$lp_rand_keys = array_rand($products, 6); // Make sure there are 3 or more 'featured' products
foreach ($lp_rand_keys as $rand_key) $lp_rand_products[$rand_key] = $products[$rand_key];
$products = $lp_rand_products;
$GLOBALS['smarty']->assign('LATEST_PRODUCTS', $products);

 

This will limit the amount of 'latest products' to 6 (so change if you require more), and then with each page refresh, those 6 products will change randomly.

 

Not my work by the way, so I can't take any credit.

Edited by keat
  • Like 1
Link to comment
Share on other sites

On 5/26/2017 at 2:50 AM, keat said:

I used this in 6.0.10 for a while, it may still work in later versions.

 

in classes/cubecart.class.php

change

$GLOBALS['smarty']->assign('LATEST_PRODUCTS', $products);

To:


$lp_rand_keys = array_rand($products, 6); // Make sure there are 3 or more 'featured' products
foreach ($lp_rand_keys as $rand_key) $lp_rand_products[$rand_key] = $products[$rand_key];
$products = $lp_rand_products;
$GLOBALS['smarty']->assign('LATEST_PRODUCTS', $products);

 

This will limit the amount of 'latest products' to 6 (so change if you require more), and then with each page refresh, those 6 products will change randomly.

 

Not my work by the way, so I can't take any credit.

Great thank you! It works absolutely fine!

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...