Bukimedia / PrestaSharp

CSharp .Net client library for the PrestaShop API via web service
GNU General Public License v3.0
154 stars 152 forks source link

Getfilter product not found #461

Closed DrZamo closed 1 year ago

DrZamo commented 1 year ago

Hi. I use prestashop 1.7.8.8 i use prestasharp vb.net 1.2.6 i use restasharp 106.11.4

Il getbyfilter product not result currect value

Exemple: I have a reference "123" in prestashop.

    Dim prodottifactory As New Factories.ProductFactory(My.Settings.sitoapips, My.Settings.CHIAVE, "")
    Dim objFiltro = New Dictionary(Of String, String)
    objFiltro.Add("reference", "123")
    Dim products As New List(Of Entities.product)
    products = prodottifactory.GetByFilter(objFiltro, Nothing, 1)

Product not return value. The referente "123" is true!

if change parameter in debug: Exemple products = prodottifactory.GetByFilter(objFiltro, "id_ASC", 1) Product is true

The problem is the memory cache? Help Me please

jesiiu commented 1 year ago

Hi, it is reference of main product or product variant ?

DrZamo commented 1 year ago

Hi, in main product, variant, category and manifacture

jesiiu commented 1 year ago

Depending on where you have the field completed you need to use the right connection, I mean the right Factory, for variants there is a separate one so maybe that's why it doesn't find the given reference, additionally I would set GetByFilter(objFiltro, Nothing, Nothing)

DrZamo commented 1 year ago

another broken example: function that deletes products without images GetByFilter always finds 1100 products. If I change the filter in debug, it updates the list. Example: products = prodottifactory.GetByFilter(objFiltro, "id_DESC", Nothing)

Functioon clearnoimage() Dim prodottifactory As New Factories.ProductFactory(My.Settings.sitoapips, My.Settings.chiave, "") Dim objFiltro = New Dictionary(Of String, String) Dim products As New List(Of Entities.product) products = prodottifactory.GetByFilter(objFiltro, Nothing, Nothing) For a = 0 To products. Count - 1 If products(a).associations.images.Count = 0 Or products(a).associations.categories.Count = 0 Then Try prodottifactory.Delete(products(a)) Catch ex As Exception RichTextBox1.Text = ex.Message & " " & products(a).reference & vbNewLine & RichTextBox1.Text End Try RichTextBox1.Text = "delete " & products(a).reference & vbNewLine & RichTextBox1.Text My.Application.DoEvents() End If Next End Function

I am going crazy

jesiiu commented 1 year ago

I think there is issue in VB Library, you should use c# and you will have no problems with this library, i tested all options in my program and everything work well, add get and delete.

DrZamo commented 1 year ago

ok i'll do the test

DrZamo commented 1 year ago

is possible configuration php, cache or cnd?

jesiiu commented 1 year ago

is possible configuration php, cache or cnd?

Im not sure what you mean by configuration php with prestasharp

DrZamo commented 1 year ago

2023-03-28 18_42_39-WindowsFormsApp1 (In debug) - Microsoft Visual Studio i tried in c# the same happens see attachment 6836 is the id of a previously deleted product. Why do you find it?

DrZamo commented 1 year ago

I fixed it by disabling dynamic cache. solution in the file .htaccess

Header set Cache-Control "private"