0

如何使用 Fishpig Wordpress 集成从 Magento 向 Wordpress index.php 发送请求?

我用 Fishpig Wordpress 集成设置了 Magento CE。该博客已通过 Fishpig 扩展正确集成到 Magento 中。Wordpress 安装在 magento_root/wp 目录中。我的“Wordpress 地址”是http://site.localhost/wp。我的“站点地址”是“ http://site.localhost/blog ”。

我正在尝试使用博客复制 Magento 页面侧边栏中的 Jetpack 订阅侧边栏小部件,但无法找到将请求发送到的正确 url。使用 Worpress + Jetpack 并且没有 Magento 集成,请求被发送到“ http://site.localhost/wp ”,请求对象如下所示:

[email] => me@example.com
[action] => subscribe
[source] => http://site.localhost/wp/
[sub-type] => widget
[redirect_fragment] => blog_subscription-2
[_wpnonce] => ab277d6d6f
[jetpack_subscriptions_widget] => Subscribe

我尝试使用http://site.localhost/blog/index.phphttp://site.localhost/wp/index.php作为我的请求 url。

4

1 回答 1

0

我通过以下方式解决了这个问题:

  1. 创建一个 Magento “订阅”控制器 - 我复制app/code/community/Fishpig/Wordpressapp/code/local/Fishpig/Wordpress/并创建app/code/local/Fishpig/Wordpress/controllers/SubscribeController.php
  2. 在. subscribeAction()_ SubscribeController.phpsubscribeAction()方法使用makeHttpPostRequest($url, array $data = array())包含在 Fishpig/Wordpress 模块中的Helper/System.php
  3. 从 Magento 订阅块模板向订阅控制器发出 ajax 请求。
于 2015-05-01T19:16:05.297 回答