List orders via Woocommerce Rest API - php

Im trying to list all orders or the latest 100 orders in my shop via woocommerce rest api v2.
I have installed there official framework from https://github.com/kloon/WooCommerce-REST-API-Client-Library
And i got it working to list all customers i have with:
$customers = $woocommerce->get('customers');
But when i try to list all orders per there documentation
$orders = $woocommerce->get('orders');
i get an error:
Fatal error: Uncaught Automattic\WooCommerce\HttpClient\HttpClientException: The decoded property name is invalid in /home/xxx/xxx/vendor/automattic/woocommerce/src/WooCommerce/HttpClient/HttpClient.php:375 Stack trace:
#0 /home/xxx/xxx/vendor/automattic/woocommerce/src/WooCommerce/HttpClient/HttpClient.php(414): Automattic\WooCommerce\HttpClient\HttpClient->processResponse()
#1 /home/xxx/xxx/vendor/automattic/woocommerce/src/WooCommerce/Client.php(82): Automattic\WooCommerce\HttpClient\HttpClient->request('orders', 'GET', Array, Array)
#2 /home/xxxx/xxxx/index.php(27): Automattic\WooCommerce\Client->get('orders')
#3 {main} thrown in /home/xxxx/xxxx/vendor/automattic/woocommerce/src/WooCommerce/HttpClient/HttpClient.php on line 375

Related

Error When Trying To Fetch Webhooks List via Shopify API

I am building a Shopify App in PHP using Shopify's own PHP library for Shopify API
When I try to fetch current webhooks, I get this error:
Fatal error: Uncaught TypeError: Argument 1 passed to Shopify\Utils::loadCurrentSession() must be of the type array, null given, called in /www/doc/www.example.com/www/script/index.php on line 45 and defined in /www/doc/www.example.com/www/script/vendor/shopify/shopify-api/src/Utils.php:158 Stack trace: #0 /www/doc/www.example.com/www/script/index.php(45): Shopify\Utils::loadCurrentSession(NULL, NULL, NULL) #1 {main} thrown in /www/doc/www.example.com/www/script/vendor/shopify/shopify-api/src/Utils.php on line 158
PHP code:
$this->test_session = Utils::loadCurrentSession(
$requestHeaders,
$requestCookies,
$isOnline
);
Webhookv2::webhooks(
$this->test_session, // Session
[], // Url Ids
[], // Params
);
Utils.php is part of the Shopify API PHP library

Magento 1.9.3 Uncaught Error: Call to a member function getMethodInstance() on boolean Payment/Model/Observer.php

I am using Magento version 1.9.3 and payment gateway from CCAvenue.
At the time of checkout and sucessfull making the payment, when returning back to the website from CCAvenue. I am getting this error instead of successfull payment:
Fatal error: Uncaught Error: Call to a member function getMethodInstance() on boolean in app/code/core/Mage/Payment/Model/Observer.php:46 Stack trace:
#0 app/code/core/Mage/Core/Model/App.php(1358): Mage_Payment_Model_Observer->salesOrderBeforeSave(Object(Varien_Event_Observer))
#1 app/code/core/Mage/Core/Model/App.php(1337): Mage_Core_Model_App->_callObserverMethod(Object(Mage_Payment_Model_Observer), 'salesOrderBefor...', Object(Varien_Event_Observer))
#2 app/Mage.php(448): Mage_Core_Model_App->dispatchEvent('sales_order_sav...', Array)
#3 app/code/core/Mage/Core/Model/Abstract.php(391): Mage::dispatchEvent('sales_order_sav...', Array)
#4 app/code/core/Mage/Sales/Model/Order.php(2117): Mage_Core_Model_Abstract->_beforeSave()
#5 app/code/core/Mage/Core/Model/Abstract.php(316): Mage_Sales_Model_Order-> in app/code/core/Mage/Payment/Model/Observer.php on line 46
So far, I googled for solutions and tried couple of things like below:
$payment = $order->getPayment();
if(!isset($payment)) {
return $this->_redirect('checkout/cart');
}
With this solution, I am able to return to the checkout/cart but with the message of invalid access. Whereas the order is successfully done and the payment has deduction applied in all the cases.
I have also check the log but there is nothing that I can trace and rectify, FYI, here is the log relevant to it:
Stack trace:
#0 app/code/core/Mage/Core/Model/App.php(1358): Mage_Payment_Model_Observer->salesOrderBeforeSave(Object(Varien_Event_Observer))
#1 app/code/core/Mage/Core/Model/App.php(1337): Mage_Core_Model_App->_callObserverMethod(Object(Mage_Payment_Model_Observer), 'salesOrderBefor...', Object(Varien_Event_Observer))
#2 app/Mage.php(448): Mage_Core_Model_App->dispatchEvent('sales_order_sav...', Array)
#3 app/code/core/Mage/Core/Model/Abstract.php(391): Mage::dispatchEvent('sales_order_sav...', Array)
#4 app/code/core/Mage/Sales/Model/Order.php(2117): Mage_Core_Model_Abstract->_beforeSave()
#5 app/code/core/Mage/Core/Model/Abstract.php(316): Mage_Sales_Model_Order-> in app/code/core/Mage/Payment/Model/Observer.php on line 46
This happens when order object is not loaded correctly.
In this case "order id" from session is missing while loading order object.
In CcavenuepayController.php, response handler function
search for
$order = Mage::getModel('sales/order')->loadByIncrementId($session->getLastRealOrderId());
Replace with
$order = Mage::getModel('sales/order')->loadByIncrementId($response_array['order_id']);
We are replacing session order id with ccavenue response order id.

PIMCORE: getting 500 Error, Grid column configuration with objectbricks

Getting Below Error in PIMCORE demo Site
Senario: product grid adding new objectBricks Column and try to sort by id
Status: 500 | Internal Server Error
URL: /admin/object/grid-proxy/classId/12/folderId/33?xaction=read&_dc=1491992052100
Params:
-> language: en_GB
-> class: Product
Fatal error: Uncaught exception 'Zend_Db_Statement_Mysqli_Exception' with message 'Mysqli prepare error: Column 'o_id' in order clause is ambiguous' in /home/pimcore_ecommercedemo/www/vendor/zendframework/zendframework1/library/Zend/Db/Statement/Mysqli.php:77
Stack trace:
#0 /home/pimcore_ecommercedemo/www/vendor/zendframework/zendframework1/library/Zend/Db/Statement.php(115): Zend_Db_Statement_Mysqli->_prepare('SELECT COUNT(*)...')
#1 /home/pimcore_ecommercedemo/www/vendor/zendframework/zendframework1/library/Zend/Db/Adapter/Mysqli.php(388): Zend_Db_Statement->__construct(Object(Zend_Db_Adapter_Mysqli), 'SELECT COUNT(*)...')
#2 /home/pimcore_ecommercedemo/www/vendor/zendframework/zendframework1/library/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Adapter_Mysqli->prepare('SELECT COUNT(*)...')
#3 /home/pimcore_ecommercedemo/www/vendor/zendframework/zendframework1/library/Zend/Db/Adapter/Abstract.php(828): Zend_Db_Adapter_Abstract->query(Object(Zend_Db_Select), Array)
#4 [internal function]: Zend_Db_Adapter_Abstract->fetchOne in /home/pimcore_ecommercedemo/www/vendor/zendframework/zendframework1/library/Zend/Db/Statement/Mysqli.php on line 77
Related issue on github:
https://github.com/pimcore/pimcore/issues/1439
This sounds like a JOIN problem. When two tables have similar columns, (i.e. o_id), MySQL is not sure which column you mean. You have to specify tablename.o_id in order to get rid of this ambiguity error message.
Please ckeck solution for below link.
Solution : https://github.com/pimcore/pimcore/issues/1439

Integrating Search-SphinxsearchBundle into Symfony

I'm using Symfony-standard,
I have installed Search-SphinxsearchBundle
I was assuming, i would use it's services in controller, to fetch documentation in my app/Resources/docs, where there's index.srt, I need to know how to direct the bundle to search from my folder.
I want to use it to query my index.srt documentations in app/Resources/docs.
I'm stuck on app/config/config.yml
sphinxsearch:
indexes:
- name: books
index:
- %sphinxsearch_index_books%
field_weights:
label: 10
content: 5
I'm getting this error:
Fatal error: Uncaught exception 'Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException'
with message 'You have requested a non-existent parameter "sphinxsearch_index_pages".'
in /usr/local/dev/hris/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php:108 Stack trace:
#0 /usr/local/dev/hris/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php(234): Symfony\Component\DependencyInjection\ParameterBag\ParameterBag->get('sphinxsearch_in...')
#1 /usr/local/dev/hris/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php(205): Symfony\Component\DependencyInjection\ParameterBag\ParameterBag->resolveString('%sphinxsearch_i...', Array)
#2 /usr/local/dev/hris/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php(195): Symfony\Component\DependencyInjection\ParameterBag\ParameterBag->resolveValue('%sphinxsearch_i...', Array)
#3 /usr/local/dev/hris/vendo in /usr/local/dev/hris/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php on line 108

Uncaught exception 'Zend_Acl_Exception' with message 'Resource not found'

I am new to Zend Framework and I am trying to build a small website using it. So to build CMS I found one source code that is on Apress website of author Forrest Lyman. I also got the book from local market.
I wanted to have admin module separately so I have created admin module but I got problem in that I am not able to access controller other than IndexController. When I try to access other controller in admin module I am getting this error:
Fatal error: Uncaught exception 'Zend_Acl_Exception' with message 'Resource 'category' not found' in C:\Server\Zend\ZendServer\share\ZendFramework\library\Zend\Acl.php:365 Stack trace: #0 C:\Server\Zend\ZendServer\share\ZendFramework\library\Zend\Acl.php(846): Zend_Acl->get('category') #1 C:\Server\Zend\Apache2\htdocs\cms\library\CMS\Controller\Plugin\Acl.php(52): Zend_Acl->isAllowed('administrator', 'category', 'index') #2 C:\Server\Zend\ZendServer\share\ZendFramework\library\Zend\Controller\Plugin\Broker.php(309): CMS_Controller_Plugin_Acl->preDispatch(Object(Zend_Controller_Request_Http)) #3 C:\Server\Zend\ZendServer\share\ZendFramework\library\Zend\Controller\Front.php(941): Zend_Controller_Plugin_Broker->preDispatch(Object(Zend_Controller_Request_Http)) #4 C:\Server\Zend\ZendServer\share\ZendFramework\library\Zend\Application\Bootstrap\Bootstrap.php(97): Zend_Controller_Front->dispatch() #5 C:\Server\Zend\ZendServer\share\ZendFramework\library\Zend\Application.php(366): Zend_Application_Bootstrap_Bootstrap->run() #6 in C:\Server\Zend\ZendServer\share\ZendFramework\library\Zend\Controller\Plugin\Broker.php on line 312
I found the solution..
After making a controller, I have to add resources in Acl.php file which is located in (library/CMS/Controller/Plugin/).
Just add this in add resources section
$acl->add(new Zend_Acl_Resource('category'));
Then you can access it.
Thanks.

Categories