Add multiple actions to the product list finder through services

Source: Internet
Author: User

Similar effects:

First, we need to add a service in services. xml under our own app:

1 <! -- B2C product information extension actions --> 2 <service id = "B2C. goods_finder_actions"> 3 <class> app_ B2C _goods </class> 4 </service>

Then go to the app/base and perform the CMD update operation.

Then you need to add this section under the index method in B2C/controller/admin/goods. php:

1 // Add an extension product list button interface 2 foreach (kernel: servicelist ('B2C. goods_finder_actions ') as $ object) 3 {4 If (is_object ($ object) & method_exists ($ object, 'Get _ extends_actions ')) {5 $ actions = $ object-> get_extends_actions ($ this); 6 $ custom_actions = array_merge ($ custom_actions, $ actions); 7} 8}

Create the corresponding lib folder and file in your app, and run the following code:

1 <? PHP 2 class app_ B2C _goods {3 Public Function get_extends_actions ($ OBJ) {4 $ action [] = array (5 'label' => app: Get ('provision ') -> _ ('button you want to add '), 6 'icon' => 'add.gif ', 7 'href' => 'index. PHP? APP = app & CTL = admin_ B2C _goods & act = youract ', 8 'target' => 'Dialog ::{ title: \' the button you want to add \ ', width: 400, height: 120} '); 9 return $ action; 10} 11}

In this way, you can add actions to the finder of the product list!

Add multiple actions to the product list finder through services

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.