在我以前这样做之前:
$response['url'] = Mage::getBaseUrl() .'module/controller/action?sku=' . $request['sku'] . '&qty=';现在我需要使用::getUrl() ,但我似乎无法理解如何使用保留的特殊值( 这里的教程 )。
所以现在我这样做:
$response['url'] = Mage::getUrl('module/controller/action', array('sku_query' => $item['sku'], 'qty_query' => ''));我的url字符串如下: ...module/controller/action/sku_query/skuValue/而不是? 和&用于GET查询字符串。 而且qty也不见了......
然而,我希望它看起来像...module/controller/action?sku=skuValue&qty=
调试器的屏幕截图,用于检查url的值:
代码如何看起来:
Mage::getUrl('orderbysku/producttype/showpopupinproductviewpage', array('_query' => 'sku='.$item['sku'].'&qty='))Before I used to do this:
$response['url'] = Mage::getBaseUrl() .'module/controller/action?sku=' . $request['sku'] . '&qty=';Now I am required to use ::getUrl(), but I can't seem to understand how to make use of the reserved special values (tutorial here).
So now I do this:
$response['url'] = Mage::getUrl('module/controller/action', array('sku_query' => $item['sku'], 'qty_query' => ''));and my url string comes out like this: ...module/controller/action/sku_query/skuValue/ instead of with ? and & for the GET query strings. And also the qty is missing...
Whereas, I want it to look like ...module/controller/action?sku=skuValue&qty=
Screenshot from the debugger, to check the value of the url:
How the code looks:
Mage::getUrl('orderbysku/producttype/showpopupinproductviewpage', array('_query' => 'sku='.$item['sku'].'&qty='))最满意答案
这应该是诀窍:
Mage::getUrl( 'module/controller/action', array('_query' => 'sku=' . $item['sku'] . '&qty=') );This should do the trick:
Mage::getUrl( 'module/controller/action', array('_query' => 'sku=' . $item['sku'] . '&qty=') );更多推荐
发布评论