Giter Site home page Giter Site logo

Comments (27)

josegrad avatar josegrad commented on May 3, 2024 1

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.

josegrad avatar josegrad commented on May 3, 2024 1

Aha. I haven't yet checked anything with 2.0...
1.4, 1.5 and 1.6, but not 2.0 yet.

from prestashop.

jirikolarik avatar jirikolarik commented on May 3, 2024 1

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.

jirikolarik avatar jirikolarik commented on May 3, 2024 1

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.

Haseeb717 avatar Haseeb717 commented on May 3, 2024

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.

josegrad avatar josegrad commented on May 3, 2024

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.

Haseeb717 avatar Haseeb717 commented on May 3, 2024

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.

josegrad avatar josegrad commented on May 3, 2024

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.

Haseeb717 avatar Haseeb717 commented on May 3, 2024

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.

Haseeb717 avatar Haseeb717 commented on May 3, 2024

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.

Haseeb717 avatar Haseeb717 commented on May 3, 2024

2.0.0

from prestashop.

Haseeb717 avatar Haseeb717 commented on May 3, 2024

with 1.4,1.5 these commands working?

from prestashop.

josegrad avatar josegrad commented on May 3, 2024

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.

Haseeb717 avatar Haseeb717 commented on May 3, 2024

you mean this gem is not working properly?

from prestashop.

josegrad avatar josegrad commented on May 3, 2024

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.

Haseeb717 avatar Haseeb717 commented on May 3, 2024

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.

josegrad avatar josegrad commented on May 3, 2024

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.

Haseeb717 avatar Haseeb717 commented on May 3, 2024

Thanks :)

from prestashop.

josegrad avatar josegrad commented on May 3, 2024

No prob.

from prestashop.

Haseeb717 avatar Haseeb717 commented on May 3, 2024

@jirikolarik Any information about product post?

from prestashop.

Haseeb717 avatar Haseeb717 commented on May 3, 2024

@houndci-bot

from prestashop.

Haseeb717 avatar Haseeb717 commented on May 3, 2024

Prestashop::Api::Converter.build(:products, :product, hash)
it returns error
TypeError: no implicit conversion of Symbol into Integer

from prestashop.

jirikolarik avatar jirikolarik commented on May 3, 2024

Take a look here

from prestashop.

Haseeb717 avatar Haseeb717 commented on May 3, 2024

and in Prestashop::Mapper::Product.new
NoMethodError: undefined method `plain' for nil:NilClass

from prestashop.

Haseeb717 avatar Haseeb717 commented on May 3, 2024

Prestashop::Api::RequestFailed: Internal error. To see this error please display the PHP errors.. XML SENT: :(

from prestashop.

DhanashriJoshi avatar DhanashriJoshi commented on May 3, 2024

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.

jirikolarik avatar jirikolarik commented on May 3, 2024

@DhanashriJoshi seems like a problem with database.

from prestashop.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.