GithubHelp home page GithubHelp logo

go-prestashop-api's People

Contributors

dinistavares avatar

Watchers

 avatar

go-prestashop-api's Issues

Can't get Product.Name in search results

I'm testing the api with default prestashop 8.1.3

params := &prestashop.ServiceListParams{
	Display: &prestashop.ServiceListDisplay{
		"id",
		"name",
		"price",
	},
}

list, response, err := client.Product.List(params)
if err != nil {
	slog.Error("prestashop", "err", err.Error())
	return
}

slog.Info("prestashop", "response", response)

for _, v := range *list {
	//slog.Info("prestashop", "product", v)
	slog.Info("prestashop", "product", fmt.Sprintf("id: %d, name: %s, price: %s", v.ID, v.Name, v.Price))
}

Then I got these:

2024/01/12 22:33:48 INFO prestashop product="id: 1, name: , price: 23.900000"
2024/01/12 22:33:48 INFO prestashop product="id: 2, name: , price: 35.900000"
2024/01/12 22:33:48 INFO prestashop product="id: 16, name: , price: 12.900000"

Please help, thanks,

[email protected]

Struct Name or Tag Error

As the new struct LanguageData with Language array, the original key name should be changed back with the xml definition.

Product {
Names *LanguageData xml:"name,omitempty" json:"name,omitempty"
}
==> Product {
Name
}

and the Associations xml maybe error:

type ProductAssociations struct {
ProductRows *[]ProductRow xml:"product_rows>cart_row,omitempty" json:"cart_rows,omitempty"
}

Customer struct ID *int ?

Testing the find by email service, got these result:

2024/01/25 11:19:54 INFO prestashop "customer by email"="&{ID:0xc000014c08 IDDefaultGroup:3 IDLang:3 NewsletterDateAdd:2024-01-25 12:14:56 ..."

type Customer struct {
ID *int
...
}

Would the ID be changed to int better than *int?

Thanks

Suggestion: Add IDLang to the Query Params to get the right data

If possible, change the struct like this:

type ServiceListParams struct {
...
IDLang int
}

Then the client will return the list/detail data like:
lang = 1 & id = 1: p.Name => "Hummingbird printed t-shirt"
lang = 2 & id = 1: p.Name => "تيشيرت بطبعة الطائر الطنان"

Fill free if you have any better solution.

:)

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.