Xmlrpc checkout
-
Hi, I am running Ready! 0.3.2.4.
Adding a product (commenting line 205 and 206 in class-wp-xmlrpc-server.php) with xmlrpc via firefox poster works. But all remainig steps for a successfull order dont work.
Thx in advance for the wonderful plugin…
-
Maybe I need the checkout module:
WP_PLUGIN_DIR/ready-ecommerce/modules/checkout/controller.php. But how can I use this in class-wp-xmlrpc-server.php?Hi,
now it works. Replace toe_addToCart( $args ) in class-wp-xmlrpc-server.php
with:function toe_addToCart( $args ) { global $wp_xmlrpc_server; $userController = new userController('s'); $orderController = new orderController('s'); $productsController = new productsController('s'); $mvcHelp = new mvcHelp; $wp_xmlrpc_server->escape( $args ); $blog_id = $args[0]; $username = $args[1]; $password = $args[2]; $pid = $args[3]; $qty = $args[4]; $addQty = $args[5]; if ( ! $user = $wp_xmlrpc_server->login( $username, $password ) ) return $wp_xmlrpc_server->error; $modUserContr = $mvcHelp->getModule($userController); $modUserContr->getModel('cart')->put(array( 'pid' => $pid, 'qty' => $qty, 'addQty' => $addQty, 'options' => array(),) ); $modOrderContr = $mvcHelp->getModule($orderController); $id = $modOrderContr->getModule('order')->getCurrentID(); $sqlData = array( 'shipping_address' => array(), 'billing_address' => array(), 'shipping_module' => '', 'payment_module' => 'payondelivery', 'taxes' => 0, 'user_id' => $user->ID, 'sub_total' => $qty, 'tax_rate' => 0, 'total' => $qty, 'status' => 'pending', 'currency' => array('id'=>1, 'code'=>'USD', 'label'=>'US Dollar', 'value'=>1, 'symbol'=>'$', 'symbol_left'=>'', 'symbol_right'=>' $', 'symbol_point'=>'.', 'symbol_thousand'=>',', 'decimal_places'=>2, 'use_as_default'=>'1', 'currency_view'=>'1$', 'price_view'=>'100 000,00',), 'comments' => ' ', 'date_created' => time(), ); $dbres = frame::_()->getTable('orders')->insert($sqlData); $currentID = $modOrderContr->getModule('order')->getModel('order')->getLastID(); frame::_()->getModule('order')->setCurrentID($currentID); frame::_()->getModule('checkout')->clearCurrent(); frame::_()->getModule('order')->clearCurrent(); $cart = frame::_()->getModule('user')->getModel('cart')->get(); foreach($cart as $inCartId => $item) { $sqlData = array( 'order_id' => $currentID, 'product_id' => $item['pid'], 'product_name' => $item['name'], 'product_sku' => $item['sku'], 'product_price' => $item['price'], 'product_qty' => $item['qty'], 'product_params' => array(), ); frame::_()->getTable('orders_items')->insert($sqlData); } dispatcher::doAction('orderPost', $currentID); $modProductsContr = $mvcHelp->getModule($productsController); $modProductsContr->updateStock( $modUserContr->getModel('cart')->get() ); $modUserContr->getModule('user')->getModel('cart')->delete(); $modOrderContr->getModule('order')->unsetCurrentID(); return $dbres; }Now you can order via xmlrpc:
<?xml version="1.0"?> <methodCall> <methodName>toe.addToCart</methodName> <params><param> <value><int>15</int></value> </param> <param> <value><string>FirstPlugUserC</string></value> </param> <param> <value><string>simpleFirstPlugUserC</string></value> </param> <param> <value><int>64</int></value> </param> <param> <value><int>20</int></value> </param> <param> <value><int>20</int></value> </param> </params> </methodCall>Unfortunately the cost value is not calculated correctly.
Hello.
Sorry, but http://pastebin.de/34570 is not a part of our plugin and this is not our certified addon. If you have info about this – please provide it to me. I will try contact autor of http://pastebin.de/34570 to investigate – what is this.Regards,
Alexey.Hi Alexey,
thank you for your answer.
Although the link should be available for ever it has been expired. New link: Modified wordpress/wp-includes/class-wp-xmlrpc-server.php with “toe_addToCart( $args )”.
Except the cost calculation “toe_addToCart( $args )” works.
Regards,
EinesusHello.
I sent message using contact form on this site with request to explain – what is this and who published this. And again – if you have some info – please provide it to me, as this is not our certified addon or some our development. This include some of our classes, and main thing is that it do this incorrect. Moreover – class mvcHelp was deprecated and we not recomend to use it.Regards,
Alexey.Now it’s possible to add orders via xmlrpc.
- Install Ready! Ecommerce Shopping Cart.
- Replace your class-wp-xmlrpc-server.php with:
class-wp-xmlrpc-server.php - Copy config.php to “WP_PLUGIN_DIR . ‘/myplugin/config.php'”
- Call http://your.testdomain.net/wordpress/xmlrpc with:
<?xml version="1.0"?> <methodCall> <methodName>my.addToCart</methodName> <params><param> <value><int>15</int></value> </param> <param> <value><string>user_name</string></value> </param> <param> <value><string>user_passw</string></value> </param> <param> <value><int>64</int></value> </param> <param> <value><int>20</int></value> </param> </params> </methodCall>
Resolved
The topic ‘Xmlrpc checkout’ is closed to new replies.