cart icon indicating copy to clipboard operation
cart copied to clipboard

Argument 3 passed to ProductAdditional::__construct() must be of the type string, array given, when place order with fe-variant

Open GhanshyamBhava opened this issue 4 years ago • 5 comments

Bug Report

Current Behavior When placing an order with a fe-variant product. It throws a fatal error

Expected behavior/output A clear and concise description of what you expected to happen.

Environment

  • TYPO3 version(s): [10.4.15]
  • cart version: [e.g. 7.2.0]
  • Is your TYPO3 installation set up with Composer (Composer Mode): yes
  • OS: Untuntu, DDEV

Additional context

Issue: 1

See: image

When you place an order it's throwing constructor invalid argument. I found OrderUtility.php Line 538 value is a passing empty.

So, argument here does not meet valide.

Issue: 2 In the product in the cart, It showing array in the title of the product.

See: image

Any fix?

GhanshyamBhava avatar May 22 '21 20:05 GhanshyamBhava

Can't reproduce this error. Can you give me some more Information about your product and its configuration? How does the request looks like, when a product with frontend variants is submitted to cart.

extcode avatar May 22 '21 21:05 extcode

Hi,

Okay, I have a pretty fresh setup with TYPO3 10.4.15 + Bootstrap package (11.0.3) with DDEV (PHP 7.2). I have EXT:cart version 7.2.0 (Also, 7.1.8 having same error) and EXT:cart_product version 3.0.0. For setup, facing issue with composer and non-composer mode both.

  1. I have added some products in the storage folder with fe-variant as I said.
  2. Created product list page (Working great!)
  3. On detail page, I have added quantity 5 and default text description for fe-variant, see.
  4. Go to cart page, you will notice it's showing array array in the product name here
  5. Fill the order form and submit it. It will show you error type casting for argument, see.
  6. After fixing this issue manually, it will show you the actual error, See here.

Here is XHR info:

General:

    Request URL: https://typo-x.ddev.site/product/cart?tx_cart_cart%5Baction%5D=create&tx_cart_cart%5Bcontroller%5D=Cart%5COrder&cHash=9dadc311e3ca986dc55508139c72b62b
    Request Method: POST
    Status Code: 500 
    Remote Address: 127.0.0.1:443
    Referrer Policy: strict-origin-when-cross-origin

Response header:

    cache-control: no-cache, must-revalidate
    content-type: text/html; charset=UTF-8
    date: Sun, 23 May 2021 10:42:40 GMT
    expires: 0
    last-modified: Sun, 23 May 2021 10:42:39 GMT
    pragma: no-cache
    server: nginx/1.17.10


Request header:

    :authority: typo-x.ddev.site
    :method: POST
    :path: /product/cart?tx_cart_cart%5Baction%5D=create&tx_cart_cart%5Bcontroller%5D=Cart%5COrder&cHash=9dadc311e3ca986dc55508139c72b62b
    :scheme: https
    accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
    accept-encoding: gzip, deflate, br
    accept-language: en-US,en;q=0.9,gu-IN;q=0.8,gu;q=0.7,de;q=0.6
    cache-control: max-age=0
    content-length: 2355
    content-type: application/x-www-form-urlencoded
    cookie: cookieconsent_status=dismiss; pma_lang_https=en; be_typo_user=c1e27dc40866a5a69902f04e6926ada4; fe_typo_user=acb8c0d3677b5d9072d5f917793903e0; Typo3InstallTool=fcf0d66af2a5860ca3a59f5c20246823
    origin: https://typo-x.ddev.site
    referer: https://typo-x.ddev.site/product/cart
    sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="90", "Google Chrome";v="90"
    sec-ch-ua-mobile: ?0
    sec-fetch-dest: document
    sec-fetch-mode: navigate
    sec-fetch-site: same-origin
    sec-fetch-user: ?1
    upgrade-insecure-requests: 1
    user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36

Query string parameters:
    
    tx_cart_cart[action]: create
    tx_cart_cart[controller]: Cart\Order
    cHash: 9dadc311e3ca986dc55508139c72b62b

Form Data:

    tx_cart_cart[__referrer][@extension]: Cart
    tx_cart_cart[__referrer][@controller]: Cart\Cart
    tx_cart_cart[__referrer][@action]: show
    tx_cart_cart[__referrer][arguments]: YTowOnt9a81dd8f12231e6e646498cb550395bacdbeb43a7
    tx_cart_cart[__referrer][@request]: {"@extension":"Cart","@controller":"Cart\\Cart","@action":"show"}c79687f3de13fec69380f8ae4d4146838b241d02
    tx_cart_cart[__trustedProperties]: {"billingAddress":{"salutation":1,"title":1,"firstName":1,"lastName":1,"email":1,"company":1,"taxIdentificationNumber":1,"street":1,"zip":1,"city":1,"country":1},"orderItem":{"shippingSameAsBilling":1,"acceptTermsAndConditions":1,"acceptRevocationInstruction":1,"acceptPrivacyPolicy":1,"comment":1},"shippingAddress":{"salutation":1,"title":1,"firstName":1,"lastName":1,"email":1,"company":1,"street":1,"zip":1,"city":1,"country":1}}aa84e93a446692ee11110864e5ac747db005038e
    tx_cart_cart[billingAddress][salutation]: Mr
    tx_cart_cart[billingAddress][title]: dfg
    tx_cart_cart[billingAddress][firstName]: GHANSHYAM
    tx_cart_cart[billingAddress][lastName]: BHAVA
    tx_cart_cart[billingAddress][email]: [email protected]
    tx_cart_cart[billingAddress][company]: Devzspace
    tx_cart_cart[billingAddress][taxIdentificationNumber]: 
    tx_cart_cart[billingAddress][street]: 32, Mer street, Kalsar, mahuva
    tx_cart_cart[billingAddress][zip]: 364130
    tx_cart_cart[billingAddress][city]: BHAVNAGAR
    tx_cart_cart[billingAddress][country]: de
    tx_cart_cart[orderItem][shippingSameAsBilling]: 
    tx_cart_cart[orderItem][shippingSameAsBilling]: true
    tx_cart_cart[orderItem][acceptTermsAndConditions]: 
    tx_cart_cart[orderItem][acceptTermsAndConditions]: 1
    tx_cart_cart[orderItem][acceptRevocationInstruction]: 
    tx_cart_cart[orderItem][acceptRevocationInstruction]: 1
    tx_cart_cart[orderItem][acceptPrivacyPolicy]: 
    tx_cart_cart[orderItem][acceptPrivacyPolicy]: 1
    tx_cart_cart[orderItem][comment]: dfgdfg

Does this help? I hope so ;) I am trying to figure out keep you updated if I will found any solution!

GhanshyamBhava avatar May 23 '21 10:05 GhanshyamBhava

Ohh sorry, I wasn‘t specific enough. When I ask for the request, I was thinking about the „add to cart“ action. I'm wondering about the fact that it says "array" for the frontend variants in the shopping cart.

Thank you for your detailed information. I hope I can reproduce the error and fix it.

extcode avatar May 23 '21 11:05 extcode

Can you please send me the request of the "add to cart" action?

extcode avatar Jun 04 '21 05:06 extcode