Comments (27)
Yep.
The description is not correct.
Use, Prestashop::Client.connection.get :customers, 1 <--- customers, not customer
The configurations call I mentioned gives this for example:
{:configurations=>{:configuration=>[{:value=>"ps1614", :name=>"PS_SHOP_NAME"}, {:value=>"1.6.1.4", :name=>"PS_VERSION_DB"}]}}
What version of PS you are connecting to?
from prestashop.
Aha. I haven't yet checked anything with 2.0...
1.4, 1.5 and 1.6, but not 2.0 yet.
from prestashop.
There is already Prestashop 2.0?
Try Prestashop::Client.read
instead of Prestashop::Client.get
, or use connection as @josegrad mentioned. Looks like get
alias is not forwarded
Creating/updating products shouldn't be problem with gem, it was actually purpose of this gem. Look here
But using low level API should be also possible
Prestashop::Client::Implementation.create 'api_key', 'api_url'
Prestashop::Client.read :products
this returns all products for example
from prestashop.
Creating is about the same (post
and create
are aliases)
Prestashop::Client.create :products, payload
Where payload
is XML which Prestashop expects, you can use converter, which converts hash into required format like that
payload = Prestashop::Api::Converter.build(:products, :product, hash)
Simplier solutions is using Product
model
Prestashop::Mapper::Product.new(id_lang: 1, id_supplier: 1, reference: 'apple-macbook').create
from prestashop.
Prestashop::Client::Implementation.create 'api_key', 'api_url'
When I write this it doesnt work not give any response
Is this gem working fine?
from prestashop.
Well that alone should not give any responses. That only create the client so you can connect to the shop.
shop_client = Prestashop::Client::Implementation.create 'api_key', 'api_url'
shop_client.connection.get :configurations, nil, {:filter => {:name => "[PS_SHOP_NAME|PS_VERSION_DB]"}, :display => '[name,value]'}
Of course the API should be enabled and the required resources open...
That should show something.
from prestashop.
When I write it doesn't return anything and keep going . After some time give connection error
Prestashop::Client::Implementation.create 'api_key', 'api_url'
from prestashop.
When I do the same from console I get the instance of it.
shop_client = Prestashop::Client::Implementation.create "FZS6H...BD", "http://shop.internet.com"
=> #<Prestashop::Client::Implementation:0x007fc9b6ea86e8 @connection=#<Prestashop::Api::Connection:0x007fc9b6ea8b48 @api_key="FZS6H...BD", @api_url="http://shop.internet.com/api/">, @cache=#<Prestashop::Client::Cache:0x007fc9b94b8e28>>
If I change the url it complains about not being able to make the connection. If I change the key then it complains about the credentials.
You must make sure the shop API is really accessible.
from prestashop.
Works (y)
Can you give any example of this?
shop_client.connection.get :configurations, nil, {:filter => {:name => "[PS_SHOP_NAME|PS_VERSION_DB]"}, :display => '[name,value]'}
from prestashop.
In git it is written that
Prestashop::Client.get :customer, 1
but it gives an error
NoMethodError: undefined method `get' for Prestashop::Client:Module
from prestashop.
2.0.0
from prestashop.
with 1.4,1.5 these commands working?
from prestashop.
Well those examples I gave do work.
But depending on the PS version some more complex things might not work, and require some changes in PS code.
Try to stay away from 1.4 specially.
It would be actually sad if this gem didn't work with 2.0 as well...
Hopefully the owner can comment on the 2.0 support soon.
from prestashop.
you mean this gem is not working properly?
from prestashop.
Hmm. Nothing is perfect. Depends what you want to do with it.
Prestashop 1.4 is far from perfect. Maybe the whole Prestashop is far from perfect :-)
from prestashop.
Basically I want to upload products,delete products,update and get products on prestashop in rails.
I see this gem but till now not succeeded
.
from prestashop.
Well since I haven't used 2.0 I can't tell how far it gets.
I haven't created products with this gem, so I can't tell you how well it supports that.
It also depends on the PS APIs of each version you want to support.
For example 1.4 doesn't even allow you to filter orders by order state, very basic stuff missing sometimes...
I think the owner could tell you more, when he/she drops by.
from prestashop.
Thanks :)
from prestashop.
No prob.
from prestashop.
@jirikolarik Any information about product post?
from prestashop.
from prestashop.
Prestashop::Api::Converter.build(:products, :product, hash)
it returns error
TypeError: no implicit conversion of Symbol into Integer
from prestashop.
Take a look here
from prestashop.
and in Prestashop::Mapper::Product.new
NoMethodError: undefined method `plain' for nil:NilClass
from prestashop.
Prestashop::Api::RequestFailed: Internal error. To see this error please display the PHP errors.. XML SENT: :(
from prestashop.
Hello, I am trying to use PrestaShop Gem, but when I am trying to update the Product, I am getting following error. Can You Please Give me solution.
:message => "[PHP Notice #8] Undefined index: id (/home/29468-81260.cloudwaysapps.com/nfmgdxmjnm/public_html/classes/Product.php, line 5147)"
from prestashop.
@DhanashriJoshi seems like a problem with database.
from prestashop.
Related Issues (12)
- Typo in gemspec (homepage url) HOT 4
- Getting associations HOT 4
- can't add manufacturer with special symbols in name HOT 1
- Add 'price' parameter conform to API documentation
- Order with multiple cart_items HOT 3
- Error using PUT command in API HOT 2
- While updating Order returns TypeError: no implicit conversion of Symbol into Integer HOT 1
- product variants? HOT 26
- allow upload of local images HOT 4
- Available API calls
- can't modify frozen String HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from prestashop.