drutjkpsr67393592 2015-03-17 08:44
浏览 28

如何在类别中的广告列表中显示自定义字段

I have added custom fields from Admin panel and it is show on Ad's detail page, but I want to show on Listing Pages as well, can you tell me in with file/s I need to code, PHP file, CSS, or class file. and I dont know PHP coding, but know .Net. thanks in advance!

  • 写回答

1条回答 默认 最新

  • doutangguan2460 2015-03-17 10:46
    关注

    If I'm not mistaking, the Listing pages is the search page (where the list of items is displayed).

    In order to do that you'll have to look for search or after_search hooks in oc-includes/osclass/controller/Search.php.

    You'll need to have a DAO object too, this tutorial should get you started.

    osc_add_hook('after_search', function() {
        if (osc_is_search_page()) {
            osc_reset_items();
            while(osc_has_items()) {
                $detail = // Get your discount info for osc_item_id()
                if(isset($detail['fk_i_item_id'])) {
                    $result[osc_item_id()] = $detail;
                }
            }
            View::newInstance()->_exportVariableToView("your_plugin_name", $result);
            osc_reset_items();
        }
    });
    

    Then, in your theme search.php file, you can retrieve your discount info with something like this:

    $discounts = __get("your_plugin_name");
    while(osc_has_items()) {
        $discount = $discounts[osc_item_id()];
    }
    
    评论

报告相同问题?

悬赏问题

  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改
  • ¥20 wireshark抓不到vlan
  • ¥20 关于#stm32#的问题:需要指导自动酸碱滴定仪的原理图程序代码及仿真
  • ¥20 设计一款异域新娘的视频相亲软件需要哪些技术支持