Trying to dynamic load cm_ip_product_listing.php

Open to all! Ask other shopowners for help.
loop
Contributor
Posts: 253
Joined: Thu Mar 25, 2021 12:26 pm
Phoenix Version:
Has thanked: 7 times
Been thanked: 3 times

Re: Trying to dynamic load cm_ip_product_listing.php

Post by loop »

i can do that for testing:

Code: Select all

include $GLOBALS['oscTemplate']->map(DIR_FS_CATALOG . 'includes/modules/content/index_products/cm_ip_product_listing_v2.php');
    //$tpl_data = ['group' => $this->group, 'file' => __FILE__];
    //include 'includes/modules/content/cm_template.php';
and then it appears at the very top (which is wrong as according to my layout there has to be first a title, thenn a banner, filter and thenn the product_listing), thenn the other parts come in my index.php (and its now not twice anymore)...but besides that's in the wrong place, it doesn't help to get rid of my problem with the error, something is still not right:

Code: Select all

<div class=\"col-sm-12 cm-ip-product-listing\">\n  \n<div class=\"contentText\">\n\n<br \/>\n<b>Warning<\/b>:  Use of undefined constant TEXT_NO_PRODUCTS - assumed 'TEXT_NO_PRODUCTS' (this will throw an Error in a future version of PHP) in <b>\/mnt\/lamp-www-data\/beta_shop\/templates\/default\/includes\/components\/product_listing.php<\/b> on line <b>105<\/b><br \/>\n<div class=\"alert alert-info\" role=\"alert\">TEXT_NO_PRODUCTS<\/div>\n<\/div>\n<\/div>\n\n


Join The Code Co-op to get access to your library in the Code Co-op Forum
loop
Contributor
Posts: 253
Joined: Thu Mar 25, 2021 12:26 pm
Phoenix Version:
Has thanked: 7 times
Been thanked: 3 times

Re: Trying to dynamic load cm_ip_product_listing.php

Post by loop »

no other idea how i can execute and show the product_listing.php?
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: Trying to dynamic load cm_ip_product_listing.php

Post by ecartz »

ecartz wrote: Thu Mar 03, 2022 10:11 pm Or something more complicated like

Code: Select all

    if (Request::get_page() === 'ext/scripts/ajax_filter.php') {
      include $GLOBALS['Template']->map(DIR_FS_CATALOG . 'includes/modules/content/index_products/cm_ip_product_listing_v2.php');
    } else {
      $tpl_data = [ 'group' => $this->group, 'file' => __FILE__ ];
      include 'includes/modules/content/cm_template.php';
    }
loop
Contributor
Posts: 253
Joined: Thu Mar 25, 2021 12:26 pm
Phoenix Version:
Has thanked: 7 times
Been thanked: 3 times

Re: Trying to dynamic load cm_ip_product_listing.php

Post by loop »

hi ecartz

this does not change the problem (i already tried it yesterday), i get a error in the output of the jquery:

Code: Select all

{"manufacturers_filter_id_arr":["17","35","223"],"price_range":"","B22_ICEBILDSCHIRMDIAGONALE":"","group_space":"'B22_ICEBILDSCHIRM','B22_ICEBILDSCHIRM','B22_ICEBILDSCHIRM'","cPath":"864_22","sort":"<br \/>\n<b>Notice<\/b>:  Undefined index: sort in <b>\/mnt\/lamp-www-data\/beta_shop\/includes\/modules\/content\/index_products\/templates\/tpl_cm_ip_filter.php<\/b> on line <b>14<\/b><br \/>\n","current_category_id":"22","action":"super_filter","jquery_action":"show_products","html":"<div class=\"col-sm-12 cm-ip-product-listing\">\n  \n<div class=\"contentText\">\n\n<br \/>\n<b>Warning<\/b>:  Use of undefined constant TEXT_NO_PRODUCTS - assumed 'TEXT_NO_PRODUCTS' (this will throw an Error in a future version of PHP) in <b>\/mnt\/lamp-www-data\/beta_shop\/templates\/default\/includes\/components\/product_listing.php<\/b> on line <b>105<\/b><br \/>\n<div class=\"alert alert-info\" role=\"alert\">TEXT_NO_PRODUCTS<\/div>\n<\/div>\n<\/div>\n\n"}
it seems as (new cm_ip_product_listing_v2())->execute(); does not execute the function, as the "sort" variable is also a include (int the execute function)...very strange
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: Trying to dynamic load cm_ip_product_listing.php

Post by ecartz »

https://github.com/CE-PhoenixCart/Phoen ... O_PRODUCTS

Each page defines its own TEXT_NO_PRODUCTS with appropriate text -- apparently your ext script hasn't. Either include advanced_search_results.php or make your own.
loop
Contributor
Posts: 253
Joined: Thu Mar 25, 2021 12:26 pm
Phoenix Version:
Has thanked: 7 times
Been thanked: 3 times

Re: Trying to dynamic load cm_ip_product_listing.php

Post by loop »

i know that i didn't include the TEXT_NO_PRODUCTS and i know how to do that, but that was not my problem as the query should have products...

BUT I FOUND IT OUT what the problem was. My Jquery made a POST with the parameter to my script and thenn i made the execution function as you suggested. THe problem is that in the product_listing.php it looks for "$_GET" and not for "$_POST" that's why the query failed....

i changed it and it worked! thank you ecartz for your support, you are great!


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply