Magento Cart API未显示价格

前端之家收集整理的这篇文章主要介绍了Magento Cart API未显示价格前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在尝试使用Magento Enterprise 1.10 XML-RPC API来处理Magento安装之外的购物车/目录功能.我遇到的问题是当我加入购物车时.我可以很好地连接到API端点,登录和检索数据.以下是我用来发现Magento API工作原理的代码.
<?PHP    
   require $_SERVER['DOCUMENT_ROOT'].'/Zend/XmlRpc/Client.PHP';

   $url = 'http://mymagento.com/api/xmlrpc';
   $user = 'apiuser';
   $pass = 'apipass';

   $proxy = new Zend_XmlRpc_Client( $url );
   $sess = $proxy->call( 'login',array( $user,$pass ) );
   $cartId = $proxy->call( 'call',array( $sess,'cart.create',array( 1 ) ) );

   $pList = $proxy->call( 'call','product.list',array() ) );
   $cList = $proxy->call( 'call','customer.list',array() ) );

   $cList[0]['mode'] = 'customer';

   $setCart = $proxy->call( 'call','cart_customer.set',array( $cartId,$cList[0] ) ) );

   foreach( $pList as $prod)
   {
      if( $prod['product_id'] == 5 )
      {
          $prod['qty'] = 5;
          $addCart = $proxy->call( 'call','cart_product.add',$pAdd ) ) );
      }
   }

   $cList = $proxy->call( 'call','cart.info',array( $cartId ) ) );
   print_r( $cList );

输出

[store_id] => 1
[created_at] => 2011-05-27 13:30:57
[updated_at] => 2011-05-27 13:31:00
[converted_at] => 0000-00-00 00:00:00
[is_active] => 0
[is_virtual] => 0
[is_multi_shipping] => 0
[items_count] => 1
[items_qty] => 5.0000
[orig_order_id] => 0
[store_to_base_rate] => 1.0000
[store_to_quote_rate] => 1.0000
[base_currency_code] => USD
[store_currency_code] => USD
[quote_currency_code] => USD
[grand_total] => 0.0000
[base_grand_total] => 0.0000
[checkout_method] => customer
...
[items] => Array
(
    [0] => Array
        (
            [item_id] => 93
            [quote_id] => 119
            [created_at] => 2011-05-27 13:31:00
            [updated_at] => 2011-05-27 13:31:00
            [product_id] => 5
            [store_id] => 1
            [parent_item_id] => 
            [is_virtual] => 1
            [sku] => product1
            [name] => product
            [description] => 
            [applied_rule_ids] => 
            [additional_data] => 
            [free_shipping] => 0
            [is_qty_decimal] => 0
            [no_discount] => 0
            [weight] => 
            [qty] => 5
            [price] => 0.0000
            [base_price] => 0.0000
            [custom_price] => 
            [discount_percent] => 0.0000
            [discount_amount] => 0.0000
            [base_discount_amount] => 0.0000

但是,我只是使用相同的上述会话调用以下内容

<?PHP
    $pInfo = $proxy->call( 'call','catalog_product.info','5' ) );
    print_r( $pInfo );

我得到有关该产品的以下信息:

[product_id] => 5
[sku] => product1
[set] => 9
[type] => virtual
[categories] => Array
    (
    )

[websites] => Array
    (
        [0] => 1
    )

[type_id] => virtual
[name] => product
[description] => Test
[short_description] => Test
[news_from_date] => 
[old_id] => 
[news_to_date] => 
[status] => 1
[visibility] => 4
...
[created_at] => 2011-05-25 15:11:34
[updated_at] => 2011-05-25 15:11:34
...
[price] => 10.0000

最后,API看到物品的价格实际上是10.00美元,但是当通过API添加到购物车时,价格没有得到正确反映.

就这样它可以是一个正式回答的问题,这里找到的解决方案,http://magentocommerce.com/boards/viewthread/227044我花了两天时间搜索这个,今天拿出一个模糊的搜索词试图找到解决方

猜你在找的XML相关文章