Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

New Products For %s


Dr. Mary Calaveris

Recommended Posts

Running CE-Phoenix-master 1.0.5.4 and wishing to show a random list of products where the 'New Products For %s' (current month) is displayed

Looked into the following files below to change descending order to random but unable to locate such:
includes\languages\english\index.php
includes\languages\english\english\modules\content\index\cm_i_card_products.php
\includes\languages\english\modules\content\index_nested\cm_in_card_products.php

****************************************************************************************************

The 'New Products For %s' also shows only 4 products ... were can it be altered to display a larger amount

****************************************************************************************************

Thanks for your help.

Link to comment
Share on other sites

9 minutes ago, Dr. Mary Calaveris said:

Looked into the following files below to change descending order to random but unable to locate such:
includes\languages\english\index.php
includes\languages\english\english\modules\content\index\cm_i_card_products.php
\includes\languages\english\modules\content\index_nested\cm_in_card_products.php

You want to be looking in the module files not the language ones.

10 minutes ago, Dr. Mary Calaveris said:

The 'New Products For %s' also shows only 4 products ... were can it be altered to display a larger amount

I think this is configured from the admin.

Link to comment
Share on other sites

9 minutes ago, Dr. Mary Calaveris said:

The 'New Products For %s' also shows only 4 products ... were can it be altered to display a larger amount

In admin

Click Configuration>Maximum Values>Selection of random new products and edit value.

Live shop Phoenix 1.0.8.4 on PHP 7.4 Working my way up the versions.

Link to comment
Share on other sites

The answer is simple...

1) set the number to be display in admin

image.png.478244ba8f53a1fd5c2a65c52631cd71.png

 

2) In order to change what is displayed you need to change the sql query used in the class.

at the moment you will have it sorting by product id in decending.

 if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {
        $card_products_query = tep_db_query("select p.*, pd.*, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, if(s.status, s.specials_new_products_price, p.products_price) as final_price, p.products_quantity as in_stock, if(s.status, 1, 0) as is_special from products p left join specials s on p.products_id = s.products_id, products_description pd where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_id desc limit " . (int)MODULE_CONTENT_CARD_PRODUCTS_MAX_DISPLAY);
      } else {
        $card_products_query = tep_db_query("select distinct p.*, pd.*, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, if(s.status, s.specials_new_products_price, p.products_price) as final_price, p.products_quantity as in_stock, if(s.status, 1, 0) as is_special from products p left join specials s on p.products_id = s.products_id, products_description pd, products_to_categories p2c, categories c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . (int)$new_products_category_id . "' and p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_id desc limit " . (int)MODULE_CONTENT_CARD_PRODUCTS_MAX_DISPLAY);
      }

You just need to change "p.products_id desc" to "RAND()" as below. As always backup before making any changes.

 if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {
        $card_products_query = tep_db_query("select p.*, pd.*, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, if(s.status, s.specials_new_products_price, p.products_price) as final_price, p.products_quantity as in_stock, if(s.status, 1, 0) as is_special from products p left join specials s on p.products_id = s.products_id, products_description pd where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by RAND() limit " . (int)MODULE_CONTENT_CARD_PRODUCTS_MAX_DISPLAY);
      } else {
        $card_products_query = tep_db_query("select distinct p.*, pd.*, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, if(s.status, s.specials_new_products_price, p.products_price) as final_price, p.products_quantity as in_stock, if(s.status, 1, 0) as is_special from products p left join specials s on p.products_id = s.products_id, products_description pd, products_to_categories p2c, categories c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . (int)$new_products_category_id . "' and p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by RAND() limit " . (int)MODULE_CONTENT_CARD_PRODUCTS_MAX_DISPLAY);
      }

 

 

Link to comment
Share on other sites

 
 
 
 
 
 
8
 Advanced issues found
 
🤓
5
3 hours ago, JcMagpie said:
 
3 hours ago, JcMagpie said:
 
2 hours ago, JcMagpie said:

The answer is simple...

1) set the number to be display in admin  *** Running CE-Phoenix-master 1.0.5.4 and Under ADMIN => Maximum Values          It only allows you to change "How many records to select from to choose one random new product to display" Kindly see the image attached. Please direct me to where such is found. ***

image.png.478244ba8f53a1fd5c2a65c52631cd71.png

*** The following two changes were made and it did the trick... Thanks!  ***

2) In order to change what is displayed you need to change the sql query used in the class.

at the moment you will have it sorting by product id in decending.


 if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {
        $card_products_query = tep_db_query("select p.*, pd.*, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, if(s.status, s.specials_new_products_price, p.products_price) as final_price, p.products_quantity as in_stock, if(s.status, 1, 0) as is_special from products p left join specials s on p.products_id = s.products_id, products_description pd where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_id desc limit " . (int)MODULE_CONTENT_CARD_PRODUCTS_MAX_DISPLAY);
      } else {
        $card_products_query = tep_db_query("select distinct p.*, pd.*, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, if(s.status, s.specials_new_products_price, p.products_price) as final_price, p.products_quantity as in_stock, if(s.status, 1, 0) as is_special from products p left join specials s on p.products_id = s.products_id, products_description pd, products_to_categories p2c, categories c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . (int)$new_products_category_id . "' and p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_id desc limit " . (int)MODULE_CONTENT_CARD_PRODUCTS_MAX_DISPLAY);
      }

You just need to change "p.products_id desc" to "RAND()" as below. As always backup before making any changes.


 if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {
        $card_products_query = tep_db_query("select p.*, pd.*, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, if(s.status, s.specials_new_products_price, p.products_price) as final_price, p.products_quantity as in_stock, if(s.status, 1, 0) as is_special from products p left join specials s on p.products_id = s.products_id, products_description pd where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by RAND() limit " . (int)MODULE_CONTENT_CARD_PRODUCTS_MAX_DISPLAY);
      } else {
        $card_products_query = tep_db_query("select distinct p.*, pd.*, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, if(s.status, s.specials_new_products_price, p.products_price) as final_price, p.products_quantity as in_stock, if(s.status, 1, 0) as is_special from products p left join specials s on p.products_id = s.products_id, products_description pd, products_to_categories p2c, categories c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . (int)$new_products_category_id . "' and p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by RAND() limit " . (int)MODULE_CONTENT_CARD_PRODUCTS_MAX_DISPLAY);
      }

 

The image attached also shows that the menu's on the left are without boxes around them? What may cause such?

Thanks for your help Lee Foster (LeeFoster), Martin (mhsuffolk), and Zahid (JcMagpie).

number to be display in admin.png

Link to comment
Share on other sites

That is cused by a bad install or poorly configuerd config.php (which can result from a bad install) 😂 it's the old chicken and egg problem.

go to,

public_html/admin8262/includes/configure.php

and check these lines in your config file.

define('HTTP_CATALOG_SERVER', 'https://yourdomain.co.uk');
define('HTTPS_CATALOG_SERVER', 'https://yourdomain.co.uk');

If you have SSL cert installed the you need to be using https://

 

Link to comment
Share on other sites

  • 2 weeks later...

Thank you, Mr. Zahid (JcMagpie) 💋

You Youngman are a blessing ... as you hit the problem right on the nose ... and boy does my nose hurt.  🤮

To be helpful for those with an SSL certificate facing the same issue ... please reference below:

>>>>>>>>>> Under  /includes/configure.php <<<<<<<<<<

  define('HTTP_SERVER', 'https://YourDomainName.com'); // eg, http://localhost - should not be empty for productive servers
  define('HTTPS_SERVER', 'https://YourDomainName.com'); // eg, https://localhost - should not be empty for productive servers
  define('ENABLE_SSL', true); // secure webserver for checkout procedure?
  define('HTTP_COOKIE_DOMAIN', '');
  define('HTTPS_COOKIE_DOMAIN', '');
  define('HTTP_COOKIE_PATH', '/');
  define('HTTPS_COOKIE_PATH', '/');
  define('DIR_WS_HTTP_CATALOG', '/');
  define('DIR_WS_HTTPS_CATALOG', '/');

  define('DIR_FS_CATALOG', '/Your Directory Name Obtained From Web Host Here/');
  define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/');
  define('DIR_FS_DOWNLOAD_PUBLIC', DIR_FS_CATALOG . 'pub/');

// define our database connection
  define('DB_SERVER', 'localhost'); // eg, localhost - should not be empty for productive servers
  define('DB_SERVER_USERNAME', 'Your Database User Name Here');
  define('DB_SERVER_PASSWORD', 'Your Database User Password Here');
  define('DB_DATABASE', 'Your Database’s Name Here');
  define('USE_PCONNECT', 'false'); // use persistent connections?
  define('STORE_SESSIONS', 'mysql'); // leave empty '' for default handler or set to 'mysql'


>>>>>>>>>> Under  admin/includes/configure.php <<<<<<<<<<

  define('HTTP_SERVER', 'https://YourDomainName.com'); // eg, http://localhost or - https://localhost should not be NULL for productive servers
  define('HTTPS_SERVER', 'https://YourDomainName.com');
  define('ENABLE_SSL', true);
  define('HTTP_COOKIE_DOMAIN', '');
  define('HTTPS_COOKIE_DOMAIN', '');
  define('HTTP_COOKIE_PATH', '/admin');
  define('HTTPS_COOKIE_PATH', '/admin');
  define('HTTP_CATALOG_SERVER', 'https://YourDomainName.com');
  define('HTTPS_CATALOG_SERVER', 'https://YourDomainName.com');
  define('ENABLE_SSL_CATALOG', 'true'); // secure webserver for catalog module
  define('DIR_FS_DOCUMENT_ROOT', '/Your Directory Name Obtained From Web Host Here/'); // where your pages are located on the server. if $DOCUMENT_ROOT doesnt suit you, replace with your local path. (eg, /usr/local/apache/htdocs)
  define('DIR_WS_ADMIN', '/admin/');
  define('DIR_WS_HTTPS_ADMIN', '/admin/');
  define('DIR_FS_ADMIN', '/Your Directory Name Obtained From Web Host Here/');
  define('DIR_WS_CATALOG', '/');
  define('DIR_WS_HTTPS_CATALOG', '/');
  define('DIR_FS_CATALOG', '/Your Directory Name Obtained From Web Host Here/');
  define('DIR_WS_CATALOG_IMAGES', DIR_WS_CATALOG . 'images/');
  define('DIR_WS_CATALOG_LANGUAGES', DIR_WS_CATALOG . 'includes/languages/');
  define('DIR_FS_CATALOG_LANGUAGES', DIR_FS_CATALOG . 'includes/languages/');
  define('DIR_FS_CATALOG_IMAGES', DIR_FS_CATALOG . 'images/');
  define('DIR_FS_CATALOG_MODULES', DIR_FS_CATALOG . 'includes/modules/');
  define('DIR_FS_BACKUP', DIR_FS_ADMIN . 'backups/');
  define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/');
  define('DIR_FS_DOWNLOAD_PUBLIC', DIR_FS_CATALOG . 'pub/');

// define our database connection
  define('DB_SERVER', 'localhost');
  define('DB_SERVER_USERNAME', 'Your Database User Name Here');
  define('DB_SERVER_PASSWORD', 'Your Database User Password Here');
  define('DB_DATABASE', 'Your Database’s Name Here');
  define('USE_PCONNECT', 'false');
  define('STORE_SESSIONS', 'mysql');

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...