webdna / commerce-currency-prices

Add a product price for each currency
Other
3 stars 5 forks source link

Undefined offset error when saving new product #2

Closed Floriskoch closed 5 years ago

Floriskoch commented 5 years ago

I'm getting an Undefined offset error when trying to save a new product after updating Craft & Craft Commerce in file vendor/kuriousagency/commerce-currency-prices/src/CurrencyPrices.php on line 148. It looks like $variant->id is not present on the $prices array from the request.

I'm running on the following versions of Craft: "craftcms/cms": "3.1.29" "craftcms/commerce": "2.1.6.1"

samuelbirch commented 5 years ago

Hi, i'm having trouble replicating the issue. Can you send the post data from the request please.

Floriskoch commented 5 years ago

Hey, thanks for replying. Below you'll find the posted form data. Please note that this issue only occurs when creating a new product. Updating an existing product works just fine. Thanks!

CRAFT_CSRF_TOKEN: [token]
action: commerce/products/save-product
typeId: 2
siteId: 2
redirect: [redirect]
title: test
fields[productMedia]: 
fields[productMedia][]: 65
fields[ean]: 
fields[icon]: 
fields[courseCategory]: 
fields[productDescription]: 
fields[productDescription][new1][type]: description
fields[productDescription][new1][enabled]: 1
fields[productDescription][new1][fields][header]: 
fields[productDescription][new1][fields][body]: 
fields[highlightPoints]: 
fields[highlightPoints][0][col1]: 
fields[highlightPoints][1][col1]: 
fields[highlightPoints][2][col1]: 
fields[courseIncludedProducts]: 
fields[courseDescription]: 
fields[courseDescription][new1][type]: description
fields[courseDescription][new1][enabled]: 1
fields[courseDescription][new1][fields][courseHighlights]: 
fields[courseDescription][new1][fields][courseHighlights][0][col1]: 
fields[courseDescription][new1][fields][includedItems]: 
fields[courseDescription][new1][fields][includedItems][0][col1]: 
q: 
fields[location]: {"address":"","lat":null,"lng":null,"zoom":8,"parts":{"number":"","address":"","city":"","postcode":"","county":"","state":"","country":""}}
fields[relatedCourses]: 
fields[metaTitle]: 
fields[metaDescription]: 
variants: 
variants[new1][enabled]: 1
variants[new1][isDefault]: 1
variants[new1][title]: test
variants[new1][sku]: 12341234
variants[new1][price]: 100
prices[new1][EUR]: 100
variants[new1][hasUnlimitedStock]: 
variants[new1][hasUnlimitedStock]: 1
variants[new1][minQty]: 
variants[new1][maxQty]: 
variants[new1][fields][tag]: 
variants[new1][fields][calendar][date]: 
variants[new1][fields][calendar][timezone]: Europe/Amsterdam
variants[new1][fields][calendar][time]: 
variants[new1][fields][calendar][timezone]: Europe/Amsterdam
slug: teset
postDate[date]: 6/11/2019
postDate[timezone]: Europe/Amsterdam
postDate[time]: 11:06 AM
postDate[timezone]: Europe/Amsterdam
expiryDate[date]: 
expiryDate[timezone]: Europe/Amsterdam
expiryDate[time]: 
expiryDate[timezone]: Europe/Amsterdam
enabled: 1
enabledForSite: 1
taxCategoryId: 1
shippingCategoryId: 1
availableForPurchase: 
availableForPurchase: 1
freeShipping: 
promotable: 
promotable: 1
prices[new][EUR]: 
samuelbirch commented 5 years ago

How is your product type setup - with variants or without?

Floriskoch commented 5 years ago

@samuelbirch With variants.

samuelbirch commented 5 years ago

ok, still can't replicate. Would it be possible to email me a zip of your database?

Floriskoch commented 5 years ago

Sure, why not. Where do I send it to?

samuelbirch commented 5 years ago

send it to support @ kurious.agency

samuelbirch commented 5 years ago

Fixed in 2.3.9

Floriskoch commented 5 years ago

Awesome, thanks a lot!