Please help us to make AbanteCart Ideal Open Source Ecommerce Solution for everyone.

Support AbanteCart eCommerce

Author Topic: about Data Listing block - custom category  (Read 2875 times)

Offline smallfish

  • Full Member
  • ***
  • Posts: 129
  • Karma: +15/-2
    • View Profile
about Data Listing block - custom category
« on: August 22, 2013, 12:23:48 PM »
I would like to create a few custom category blocks to display the products under the specified category.
However, the block display the category in the block only but not the products in the specified category.
This is not the format which is requested by me.
I want to show all the latest products in each custom category. How can I do it?
Can abantecart modify the code to support this requirement (add an option there to display the products under the category, and only allow to display a limited no. of products only (ie, 4 to 8 products only)). Displaying the products  in the specified category is more useful than displaying a category.
« Last Edit: August 22, 2013, 12:36:41 PM by smallfish »

Offline abantecart

  • Administrator
  • Hero Member
  • *****
  • Posts: 4152
  • Karma: +251/-9
    • View Profile
    • Ideal Open Source Ecommerce Solution
Re: about Data Listing block - custom category
« Reply #1 on: August 22, 2013, 07:43:12 PM »
You can modify SQL to filter product by category in function getLatestProducts

file: storefront/model/catalog/product.php

Code: [Select]
public function getLatestProducts($limit) {
We need your help to build better free open source eCommerce platform for everyone.
See how you can help

Offline smallfish

  • Full Member
  • ***
  • Posts: 129
  • Karma: +15/-2
    • View Profile
Re: about Data Listing block - custom category
« Reply #2 on: August 22, 2013, 09:03:52 PM »
You can modify SQL to filter product by category in function getLatestProducts

file: storefront/model/catalog/product.php

Code: [Select]
public function getLatestProducts($limit) {
]]

I think that you misunderstand my question.
I want the data listing block (at front store) to show the products instead of just show the category name there when I choose the data source from the "custom category". For example, I want to show 8 rows (8 categories) and each category show 4 latest items at the front store.
How can I do it? Thank you!

Offline abantecart

  • Administrator
  • Hero Member
  • *****
  • Posts: 4152
  • Karma: +251/-9
    • View Profile
    • Ideal Open Source Ecommerce Solution
Re: about Data Listing block - custom category
« Reply #3 on: August 24, 2013, 04:15:12 PM »
Are you looking for instructions to develop new block?

You will need to create new controller and template (possibly model). Say you name block featured_categories
Place controller into  storefront/controller/blocks/featured_categories.php
Place template into storefront/view/default_html5/template/blocks/featured_categories.tpl

Add controller class ControllerBlocksFeaturedCategories and your code logic to select category and products into your controller. There are number of models available to select data
Prepare data for template and load template.
You can use any existing block as example to follow.

Add your new block to blocks table with SQL insert

Last step you need to do, add block to layout in admin.

Adding new block to block/layout tables is also possible with PHP code, see example in developer manuals.

More details is in developers manuals:
http://www.abantecart.com/document_wiki/index.php/AbanteCart_Extension%E2%80%99s_Developer_Guide
http://www.abantecart.com/document_wiki/index.php/Developing_Extensions_and_Extension_API
« Last Edit: August 24, 2013, 04:17:17 PM by abantecart »
We need your help to build better free open source eCommerce platform for everyone.
See how you can help

Offline smallfish

  • Full Member
  • ***
  • Posts: 129
  • Karma: +15/-2
    • View Profile
Re: about Data Listing block - custom category
« Reply #4 on: August 25, 2013, 05:12:39 PM »
I am not familiar with programming. In fact, I want abantecart to add this block.
Anyway, thank you for your instructions. I will try to do it myself later.
I think that I can copy the "latest block" and modify it to become the block which can fulfill my needs.
Thank you!

 

Powered by SMFPacks Social Login Mod