Zencart adds recommendation products in batches by product ID

Source: Internet
Author: User

1. Modify admin/featured. php

Search for pre_add_confirmation

Replace the code between pre_add_confirmation and break with the following code.

<? PHP  Case 'Pre _ add_confirmation ': //  Check for Blank or existing featured          $ Pre_add_products_id = $ _ Post ['Pre _ add_products_id' ];  $ Pre_add_products_id2 =Explode (',', $ Pre_add_products_id  );  Foreach ( $ Pre_add_products_id2   As   $ Key => $ Val  ){  $ SQL = "Select products_id from". table_products. "Where products_id = '". (INT) $ Val ."'" ;  $ Check_featured =$ DB -> Execute ( $ SQL  );  If ( $ Check_featured -> Recordcount () = 1 ){  $ SQL = "Select products_id from". table_featured. "Where products_id = '". (INT) $ Val ."'" ;  $ Check_featured = $ DB -> Execute ( $ SQL );  If ( $ Check_featured -> Recordcount () <1 ){  //  Add empty featured                      $ Featured_date_available = (Zen_db_prepare_input ( $ _ Post ['Start']) = '')? '1970-01-01 ': zen_date_raw ( $ _ Post ['Start' ]);  $ Expires_date = (Zen_db_prepare_input ( $ _ Post ['End']) = '')? '1970-01-01 ': zen_date_raw ( $ _ Post ['End' ]);  $ Products_id = Zen_db_prepare_input ( $ Val  );  $ DB -> Execute ("insert into". table_featured ." (Products_id, featured_date_added, expires_date, status, featured_date_available) values (' ". (INT) $ Products_id . "', Now (),'". zen_db_input ( $ Expires_date ). "', '1','". zen_db_input ($ Featured_date_available )."')" );}}}  Break  ; ?>


2. admin \ shortdes \ functions \ General. php

Search function zen_set_field_length

Add the following functions to this function:

   Function Zen_set_field_length_1000 ( $ Max = 50, $ Override = False  ){  $ Field_length = 1000 ;  Switch ( True  ){  Case (( $ Override = False And $ Field_length > $ Max )): $ Length = 'Size = "'.( $ Max + 1). '"maxlength = "'. $ Field_length .'"' ; Break  ;  Default : $ Length = 'Size = "'.( $ Field_length + 1). '"maxlength = "'. $ Field_length .'"' ;  Break  ;}  Return   $ Length  ;} 

 


3. after completing the above two steps, you can use the background catalog --> Featured Products --> click the product ID to be manually added as a featured button on the right
and enter the product ID in the text box., product IDs are separated by commas (,), for example,.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.