如何去除opencart管理面板中的广告

how to remove advertisement in opencart admin panel

如何删除管理面板中的 opencart 广告。

这里是广告:

在您的 OpenCart 安装中转到文件

/admin/controller/extension/extension/promotion.php

并在 line 18

上添加替换此代码
return $response;

有了这个

return '';

这将删除您在 OpenCart 管理面板中看到的所有促销活动。

尽情享受吧!

Dmitriy Zhuk 的答案是最容易应用的。 如果您希望更改为 mod,另一种方法是使用如下内容:

<?xml version="1.0" encoding="utf-8"?>
<modification>
    <name>Hide promotions in admin panel</name>
    <code>skippromotion</code>
    <version>3.0x</version>
    <author>TH</author>
    <link>
    <file path="admin/controller/extension/extension/*.php">
    <!-- Remove the 'promotions' feature -->
        <operation error="log">
            <search><![CDATA[$data['promotion'] = $this->load->controller('extension/extension/promotion');]]></search>
            <add position="replace"><![CDATA[
$data['promotion'] = '';
            ]]></add>
        </operation>
    </file>
</modification>

将其另存为 'install.xml',将其压缩为 'skippromotion.ocmod.zip' 并使用管理面板中的 'Installer' 上传 - 然后转到 'Modifications',启用 mod 并刷新您的 mod 缓存。广告应该从管理面板中消失。

请注意,此 mod 的工作方式与 Dmitriy Zhuk 的回答不同,它会替换对 admin/controller/extension/extension/promotion.php 的每次调用,而不是脚本 returns 的值.

显然,如果您开始自己的 OpenCart 安装农场并想向您的用户做广告,您需要在配置中禁用 mod 并更改 OPENCART_SERVER。

如果你像我一样走编辑路线,也许会更好:

 <?php
class ControllerExtensionExtensionPromotion extends Controller {
    public function index() {
    // MOD Eliminate Admin promotions - just return nothing.
    // we don't need to curl anything and might make site a touch faster
    return '';
    }
}