-1

我从管理面板添加了自定义字段,它显示在广告的详细信息页面上,但我也想显示在列表页面上,你能告诉我我需要编码的文件、PHP 文件、CSS 或类文件吗. 而且我不知道 PHP 编码,但知道 .Net。提前致谢!

4

1 回答 1

0

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()];
}
于 2015-03-17T10:46:09.740 回答