小编Jos*_*ort的帖子

WP_Query()不返回所有条目

我有这个查询只返回我在表上的一些条目.我有超过10个帖子但这个查询只返回6.请帮助提出建议

$query = new WP_Query("year=2011&monthnum=09&post_status=publish&post_type=post&orderby=post_date&order=DESC");
while ($query->have_posts()):
    $query->the_post();
    $title=get_the_Title();                                                                                                                  
    echo"<p><input type=\"checkbox\" name=\"MyArticle[]\" value=\"".get_the_ID()."\">".get_the_Title()."</p>";
endwhile;               
wp_reset_query();
Run Code Online (Sandbox Code Playgroud)

php wordpress

30
推荐指数
2
解决办法
2万
查看次数

从DynamicForm获取所有字段

我使用从xsd schema生成的DataSource.我需要从DataSource获取所有字段,也是嵌套的字段.我的问题与Smartclient论坛论坛中的这个主题一样,当我使用DataSource.getFields()它只返回第一级字段时.

有谁知道如何获得嵌套字段?

xsd smartgwt

6
推荐指数
1
解决办法
346
查看次数

即使观察者正在触发,也无法修改Magento事件观察器中的响应

我正在尝试使用观察者来修改添加到购物车控制器操作的响应,但仅限于AJAX请求的上下文中.

我的观察者调用,我的JS正在检索数据,我通过die()在我的观察者函数中放置一个cartAdd()并验证响应开发者控制台来验证这一点,我用它来查看我对Magento的响应结果.所以JS不是问题所在.

我的主要问题是我似乎无法通过正常功能修改响应.我用得到请求$observer->getEvent()->getControllerAction()->getResponse(),然后进行更改setHeader(),或者setBody(),或者修改响应的其他功能,但绝对是响应没有影响!

有没有人知道为什么我无法修改观察者的反应?

在/app/code/local/mynamespace/mymodule/etc/config.xml中:

<frontend>
....
    <events>
        <controller_action_predispatch_checkout_cart_add>
            <observers>
                <mymodule_cart_add>
                    <type>singleton</type>
                    <class>mymodule/observer</class>
                    <method>cartAdd</method>
                </mymodule_cart_add>
            </observers>
        </controller_action_predispatch_checkout_cart_add>
    </events>
</frontend>
Run Code Online (Sandbox Code Playgroud)

在/app/code/local/mynamespace/mymodule/Model/Observer.php中:

public function cartAdd(Varien_Event_Observer $observer)
{
    $controllerAction = $observer->getEvent()->getControllerAction();
    if($controllerAction->getRequest()->isAjax()) {
        $response = $controllerAction->getResponse();
        // I've even tried using:
        // $response = Mage::app()->getResponse();
        $response->setHeader('HTTP/1.1','403 Forbidden'); //using this because i will need it in my final code and it will make it immediatly obvious the response has been changed
        $response->setHeader('Content-type', …
Run Code Online (Sandbox Code Playgroud)

magento magento-1.7

5
推荐指数
1
解决办法
2925
查看次数

买方在magento产品页面中填写的字段

我一直在找,但找不到这样的东西.我需要创建一个产品页面,买方会在将产品添加到购物车之前填写一些文本字段.

像这个页面的东西:http://bitly.com/Sw4jzR

添加到购物车时,还需要保存字段.

有人在magento看到过这样的事吗?知道怎么做吗?

提前致谢.

php ajax magento

4
推荐指数
1
解决办法
682
查看次数

标签 统计

magento ×2

php ×2

ajax ×1

magento-1.7 ×1

smartgwt ×1

wordpress ×1

xsd ×1