Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

How To Get Home Page Block Data Rate Topic   - - - - -

 
  • Vivek Gupta
  • Senior Member
  • Members
  • Join Date: 09-Jul 15
  • 247 posts

Posted 20 January 2016 - 05:06 PM #1

Hello Friends ,

 

 

i wana to get homepage "products" block to get on sale & hot deal block data. 

$data=db_get_array("SELECT b.*, d.*, c.* FROM ?:bm_blocks as b INNER JOIN ?:bm_blocks_descriptions as d ON b.block_id = d.block_id INNER JOIN ?:bm_blocks_content as c ON b.block_id = c.block_id INNER JOIN ?:bm_snapping as e ON b.block_id = e.block_id INNER JOIN ?:bm_grids as f ON e.grid_id = f.grid_id INNER JOIN ?:bm_containers as g ON f.container_id = g.container_id INNER JOIN ?:bm_locations as h ON g.location_id = h.location_id WHERE b.type = ?s AND c.lang_code = ?s AND h.dispatch = ?s","products",'en','index.index');



Result:

Array
(
    [0] => Array
        (
            [block_id] => 23
            [type] => products
            [properties] => a:11:{s:8:"template";s:37:"blocks/products/products_scroller.tpl";s:10:"show_price";s:1:"N";s:17:"enable_quick_view";s:1:"N";s:24:"not_scroll_automatically";s:1:"Y";s:5:"speed";s:3:"400";s:15:"scroll_per_page";s:1:"Y";s:11:"pause_delay";s:1:"3";s:13:"item_quantity";s:1:"3";s:15:"thumbnail_width";s:3:"160";s:23:"hide_add_to_cart_button";s:1:"Y";s:18:"outside_navigation";s:1:"Y";}
            [company_id] => 0
            [lang_code] => en
            [name] => Hot deals
            [snapping_id] => 0
            [object_id] => 0
            [object_type] => 
            [content] => a:1:{s:5:"items";a:4:{s:7:"filling";s:6:"newest";s:6:"period";s:1:"A";s:9:"last_days";s:2:"10";s:5:"limit";s:1:"6";}}
        )

    [1] => Array
        (
            [block_id] => 24
            [type] => products
            [properties] => a:4:{s:8:"template";s:41:"blocks/products/products_multicolumns.tpl";s:11:"item_number";s:1:"N";s:17:"number_of_columns";s:1:"4";s:23:"hide_add_to_cart_button";s:1:"Y";}
            [company_id] => 0
            [lang_code] => en
            [name] => On Sale
            [snapping_id] => 0
            [object_id] => 0
            [object_type] => 
            [content] => a:1:{s:5:"items";a:3:{s:7:"filling";s:7:"on_sale";s:5:"limit";s:1:"8";s:3:"cid";s:0:"";}}
        )

    [2] => Array
        (
            [block_id] => 49
            [type] => products
            [properties] => a:11:{s:8:"template";s:37:"blocks/products/products_scroller.tpl";s:10:"show_price";s:1:"N";s:17:"enable_quick_view";s:1:"N";s:24:"not_scroll_automatically";s:1:"Y";s:5:"speed";s:3:"400";s:15:"scroll_per_page";s:1:"Y";s:11:"pause_delay";s:1:"3";s:13:"item_quantity";s:1:"4";s:15:"thumbnail_width";s:3:"160";s:23:"hide_add_to_cart_button";s:1:"Y";s:18:"outside_navigation";s:1:"Y";}
            [company_id] => 0
            [lang_code] => en
            [name] => Hot deals
            [snapping_id] => 0
            [object_id] => 0
            [object_type] => 
            [content] => a:1:{s:5:"items";a:4:{s:7:"filling";s:6:"newest";s:6:"period";s:1:"A";s:9:"last_days";s:2:"10";s:5:"limit";s:1:"6";}}
        )

    [3] => Array
        (
            [block_id] => 24
            [type] => products
            [properties] => a:4:{s:8:"template";s:41:"blocks/products/products_multicolumns.tpl";s:11:"item_number";s:1:"N";s:17:"number_of_columns";s:1:"4";s:23:"hide_add_to_cart_button";s:1:"Y";}
            [company_id] => 0
            [lang_code] => en
            [name] => On Sale
            [snapping_id] => 0
            [object_id] => 0
            [object_type] => 
            [content] => a:1:{s:5:"items";a:3:{s:7:"filling";s:7:"on_sale";s:5:"limit";s:1:"8";s:3:"cid";s:0:"";}}
        )

    [4] => Array
        (
            [block_id] => 65
            [type] => products
            [properties] => a:11:{s:8:"template";s:37:"blocks/products/products_scroller.tpl";s:10:"show_price";s:1:"Y";s:17:"enable_quick_view";s:1:"N";s:24:"not_scroll_automatically";s:1:"N";s:15:"scroll_per_page";s:1:"N";s:5:"speed";s:3:"400";s:11:"pause_delay";s:2:"25";s:13:"item_quantity";s:1:"4";s:15:"thumbnail_width";s:3:"410";s:18:"outside_navigation";s:1:"Y";s:23:"hide_add_to_cart_button";s:1:"N";}
            [company_id] => 0
            [lang_code] => en
            [name] => Featured Products
            [snapping_id] => 0
            [object_id] => 0
            [object_type] => 
            [content] => a:1:{s:5:"items";a:2:{s:7:"filling";s:8:"manually";s:8:"item_ids";s:41:"12,16,17,18,148,180,187,230,231,232,56,65";}}
        )

    [5] => Array
        (
            [block_id] => 68
            [type] => products
            [properties] => a:4:{s:8:"template";s:41:"blocks/products/products_multicolumns.tpl";s:11:"item_number";s:1:"N";s:17:"number_of_columns";s:1:"4";s:23:"hide_add_to_cart_button";s:1:"N";}
            [company_id] => 0
            [lang_code] => en
            [name] => New Arrival
            [snapping_id] => 0
            [object_id] => 0
            [object_type] => 
            [content] => a:1:{s:5:"items";a:5:{s:7:"filling";s:6:"newest";s:6:"period";s:1:"A";s:9:"last_days";s:1:"1";s:5:"limit";s:1:"4";s:3:"cid";s:0:"";}}
        )

    [6] => Array
        (
            [block_id] => 70
            [type] => products
            [properties] => a:4:{s:8:"template";s:41:"blocks/products/products_multicolumns.tpl";s:11:"item_number";s:1:"N";s:17:"number_of_columns";s:1:"4";s:23:"hide_add_to_cart_button";s:1:"Y";}
            [company_id] => 0
            [lang_code] => en
            [name] => Sale Products
            [snapping_id] => 0
            [object_id] => 0
            [object_type] => 
            [content] => a:1:{s:5:"items";a:3:{s:7:"filling";s:7:"on_sale";s:5:"limit";s:1:"4";s:3:"cid";s:0:"";}}
        )

)

Here is 6 block get in init.php ,   please suggest a way to get only onsale & hotdeal block data.  so that we can get the home page products list.

 

 

 

Thanks in advance .

 


Vivek Gupta 
 


 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 21741 posts

Posted 21 January 2016 - 09:13 AM #2

Please add additional condition with block IDs (49 and 24)

 

E.g.

$data=db_get_array("SELECT b.*, d.*, c.* FROM ?:bm_blocks as b INNER JOIN ?:bm_blocks_descriptions as d ON b.block_id = d.block_id INNER JOIN ?:bm_blocks_content as c ON b.block_id = c.block_id INNER JOIN ?:bm_snapping as e ON b.block_id = e.block_id INNER JOIN ?:bm_grids as f ON e.grid_id = f.grid_id INNER JOIN ?:bm_containers as g ON f.container_id = g.container_id INNER JOIN ?:bm_locations as h ON g.location_id = h.location_id WHERE b.type = ?s AND c.lang_code = ?s AND h.dispatch = ?s AND b.block_id IN (?n)","products",'en','index.index', array(49,24));


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    Multi-Vendor PLUS           USD 3100 (2775)
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      Multi-Vendor Ultimate       USD 7500 (6000)

 
  • Vivek Gupta
  • Senior Member
  • Members
  • Join Date: 09-Jul 15
  • 247 posts

Posted 21 January 2016 - 09:36 AM #3

Thanks Ecom,

 

But how to i know that which block id (product type) used in home page.

 

i'm using here dispatch is "index.index" & type = "products" , but i'm not getting accurate data.

I hope you it more clear now.  

 

I'm looking for more answers .


Vivek Gupta 
 


 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 21741 posts

Posted 21 January 2016 - 02:57 PM #4

Unfortunately the whole task is not quite clear. Please clarify it and let me know how many blocks do you see for the Home page in the admin panel?


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    Multi-Vendor PLUS           USD 3100 (2775)
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      Multi-Vendor Ultimate       USD 7500 (6000)

 
  • Vivek Gupta
  • Senior Member
  • Members
  • Join Date: 09-Jul 15
  • 247 posts

Posted 21 January 2016 - 03:50 PM #5

I want to access product type block which are using for index.index diapatch (homepage). & we don't know block id , then hoe i can get block,   for example we want to get properties & content of onsale & hotdeal block , how can i get  ???? 


Vivek Gupta 
 


 
  • proodie
  • Member
  • Members
  • Join Date: 07-Dec 19
  • 47 posts

Posted 21 September 2020 - 05:14 PM #6

have you done with that please help me.I have same problem. I want to display homepage data in API