Magento的车API不显示价格 [英] Magento Cart API not showing prices

查看:153
本文介绍了Magento的车API不显示价格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用Magento企业1.10 XML-RPC API来处理的Magento安装外车/目录下的功能。 ,我遇到的问题是,当我添加到购物车。我可以连接蛮好的API端点,登录和检索数据。以下是code,我使用来发现的Magento API的运作。

I am attempting to use the Magento Enterprise 1.10 XML-RPC API to handle cart/catalog functions outside of the Magento installation. The issue that I am having is when I add to cart. I can connect just fine to the API endpoint, login, and retrieve data. The following is the code that I am using to discover the workings of the 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', array( $sess, 'product.list', array() ) );
   $cList = $proxy->call( 'call', array( $sess, 'customer.list', array() ) );

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

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

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

   $cList = $proxy->call( 'call', array( $sess, '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

不过,我只是调用使用相同的上述会议的下列

However, I am to just call the following using the same above session

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

我得到关于产品的下列信息:

I get the following information about the product:

[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添加到购物价格不正确的体现。

In the end, the API sees that the price of the item is in fact $10.00, but when added to the cart via API the prices are not properly reflected.

推荐答案

只是让它可以是一个正式回答的问题,在这里被发现,<一个解决方案href=\"http://magentocommerce.com/boards/viewthread/227044\">http://magentocommerce.com/boards/viewthread/227044我花了两天时间寻找这一点,今天拿出一个不起眼的搜索词,试图找到解决办法

Just so it can be an officially answered question, here is the solution found, http://magentocommerce.com/boards/viewthread/227044 I spent two days searching for this, and today come up with an obscure search term to try and find the solution

这篇关于Magento的车API不显示价格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆