How To Show Newest Products For Each Current Category In Category Page?

Hi everyone,

I want to show latest products from each category in cs-cart category page! For example when user is on Computers category page, a block shows the newest products in computer category and also in it's subcategories.

Here is the steps I've made for this but unfortunately it didn't work!

1- I created a Product Block in categories tab of layout page (in backend).

2- in Content tab of the block set Filling to Newest with no category filter. Made this block disabled and set proper wrapper and css class. Template of the block was set to Scroller (or Grid, it doesn't matter).

3- Save the block.

Then In Categories section in Backend, I chose one category (parent category) and in that category's layout tab I enabled the block and set the category filter to this category.

Unfortunately nothing happened and no luck to see the block in that category page in storefront!

I'm thinking maybe I was doing wrong somewhere. How can I display newest products for the same category (and it's subcategories if possible) on that current category?

Thanks

Hi everyone,

I want to show latest products from each category in cs-cart category page! For example when user is on Computers category page, a block shows the newest products in computer category and also in it's subcategories.

Here is the steps I've made for this but unfortunately it didn't work!

1- I created a Product Block in categories tab of layout page (in backend).

2- in Content tab of the block set Filling to Newest with no category filter. Made this block disabled and set proper wrapper and css class. Template of the block was set to Scroller (or Grid, it doesn't matter).

3- Save the block.

Then In Categories section in Backend, I chose one category (parent category) and in that category's layout tab I enabled the block and set the category filter to this category.

Unfortunately nothing happened and no luck to see the block in that category page in storefront!

I'm thinking maybe I was doing wrong somewhere. How can I display newest products for the same category (and it's subcategories if possible) on that current category?

Thanks

app/schemas/block_manager/blocks.php

Try to replace

                    'newest' => array(
                        'params' => array(
                            'sort_by' => 'timestamp',
                            'sort_order' => 'desc',
                            'request' => array(
                                'cid' => '%CATEGORY_ID%'
                            )
                        )
                    ),

with

                    'newest' => array(
                        'params' => array(
                            'sort_by' => 'timestamp',
                            'sort_order' => 'desc',
                            'request' => array(
                                'cid' => '%CATEGORY_ID%'
                            ),
                            'subcats' => 'Y'
                        )
                    ),

Then clear cache and change global block status to Enabled

(!) Not tested, but it should do the trick

app/schemas/block_manager/blocks.php

Try to replace

                    'newest' => array(
                        'params' => array(
                            'sort_by' => 'timestamp',
                            'sort_order' => 'desc',
                            'request' => array(
                                'cid' => '%CATEGORY_ID%'
                            )
                        )
                    ),

with

                    'newest' => array(
                        'params' => array(
                            'sort_by' => 'timestamp',
                            'sort_order' => 'desc',
                            'request' => array(
                                'cid' => '%CATEGORY_ID%'
                            ),
                            'subcats' => 'Y'
                        )
                    ),

Then clear cache and enable block for and change global block status to Enabled

(!) Not tested, but it should do the trick

Thanks.

Did it solve your problem?

Did it solve your problem?

Sorry eComLabs for the long delay in my response!

Yes, it definitely solved my problem. Thank you so much for that. But is there a way to override blocks.php ? I prefer not to change the core file.

Best Regards,

Sorry eComLabs for the long delay in my response!

Yes, it definitely solved my problem. Thank you so much for that. But is there a way to override blocks.php ? I prefer not to change the core file.

Best Regards,

Sure, you can extend the schema with the My changes module and the following file:

app/addons/my_changes/schemas/block_manager/blocks.php

$schema[‘products’][‘content’][‘items’][‘fillings’][‘newest’][‘params’][‘subcats’] = ‘Y’;

return $schema;

Do not forget to clear cache

Sure, you can extend the schema with the My changes module and the following file:

app/addons/my_changes/schemas/block_manager/blocks.php

$schema[‘products’][‘content’][‘items’][‘fillings’][‘newest’][‘params’][‘subcats’] = ‘Y’;

return $schema;

Do not forget to clear cache

Thank you so much :-)

You are welcome!

eComLabs, I didn't now you could use mychanges to modify the schemas/block_manager/blocks.php script.

I've added a new block to that script. Is there a way to do this via mychanges?
I added this code to just before

);

if (fn_allowed_for('MULTIVENDOR')) {

in the schemas/block_manager/blocks.php script

'html_block_parallax' => array (
	'content' => array (
	'content' => array (
	'type' => 'text',
	'required' => true,
	)
   ),
   'settings' => array(
        'slider_width' => array (
	'type' => 'selectbox',
	'values' => array (
	'boxed' => 'boxed',
	'full' => 'full',
	),
   'default_value' => 'full'
	),
   ),
  'templates' => 'blocks/html_block_parallax.tpl',
  'wrappers' => 'blocks/wrappers',
  'cache' => array(
  'update_handlers' => array ('bm_blocks_content'),
  ),
  'multilanguage' => true,
)

It would be better to put it into mychanges - is it possible?

Sure, it is possible. Use example from post #6 to do it