php - 在 Prestashop Feeder 中将数据添加到文件
问题描述
我正在尝试添加此代码:
$date = date('r', strtotime($product['date_add'])); echo '<pubdate>'.$date.'</pubdate>';
到 Prestashop Feeder 模块https://github.com/PrestaShop/feeder 中的 rss.php 文件,以便在 Mailchimp rss 电子邮件中包含所有产品(现在它只显示一个,因为缺少日期参考)
但我不知道在哪里添加它。
class Ps_FeederrssModuleFrontController extends ModuleFrontController
{
private function getProducts($idCategory, $nProducts, $orderBy, $orderWay)
{
$category = new Category($idCategory);
...
);
}
}
return $productsForTemplate;
}
private function getSmartyVariables()
{
$id_category = (int)Tools::getValue('id_category');
$id_category = $id_category ? $id_category : Configuration::get('PS_HOME_CATEGORY');
$number = (int)Tools::getValue('n', 4);
$number = $number > 4 ? 4 : $number;
$orderBy = Tools::getProductsOrder('by', Tools::getValue('orderby'));
$orderWay = Tools::getProductsOrder('way', Tools::getValue('orderway'));
$products = $this->getProducts($id_category, $number, $orderBy, $orderWay);
return array(
'products' => $products,
'currency' => new Currency((int)$this->context->currency->id),
'affiliate' => (Tools::getValue('ac') ? '?ac=' . (int)Tools::getValue('ac') : ''),
'metas' => Meta::getMetaByPage('index', (int)$this->context->language->id),
'shop_uri' => Tools::getShopDomainSsl(true, true) . __PS_BASE_URI__,
'shop_name' => Configuration::get('PS_SHOP_NAME'),
'shop_email' => Configuration::get('PS_SHOP_EMAIL'),
'language_iso' => $this->context->language->iso_code,
'logo' => $this->context->link->getMediaLink(_PS_IMG_ . Configuration::get('PS_LOGO')),
);
}
public function initContent()
{
parent::initContent();
$this->context->smarty->assign($this->getSmartyVariables());
header("Content-Type:text/xml; charset=utf-8");
$this->setTemplate('module:ps_feeder/views/template/front/rss.tpl');
}
}
解决方案
推荐阅读
- google-compute-engine - 在不关闭实例的情况下调整云 VM 磁盘大小(谷歌云)
- python - Keras:使用灰度蒙版和 ImageDataGenerator 类进行图像分割
- mdc-components - 如何在 lit 元素中使用 MDC 组件?
- r - 在 SpatialPolygonDataFrame 中计算人口
- migration - 用于优化构建的 Angular 6 升级运行时问题
- scala - 如何创建涉及某些功能在范围内的“块”的 DSL?
- python - 在 Python3 上使用 Pandas 未对齐数据框
- r - Plot dates with regular interval in R
- python-3.x - 如何使用烧瓶获取图像上传到服务器的元数据。
- angular - 角度自定义控件 - 星级 - 来自输入的值