Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

We can't add this item to your shopping cart right now #51

Closed
zehsergio opened this issue Mar 27, 2018 · 46 comments
Closed

We can't add this item to your shopping cart right now #51

zehsergio opened this issue Mar 27, 2018 · 46 comments

Comments

@zehsergio
Copy link

After install the plugin and configure (force luma).... I can't put products in the shopping cart.

Magento message: We can't add this item to your shopping cart right now.

@danslo
Copy link
Owner

danslo commented Mar 27, 2018

Well, since you opened this ticket: did you install the module using composer? Because there are a couple of dependencies that are important for this module to run, you can't just drop it into app/code folder.

@zehsergio
Copy link
Author

Yes... i install with composer

@danslo
Copy link
Owner

danslo commented Mar 27, 2018

Is there any message in your log files (var/log, system.log or exception.log)? There should be something there.

If not, add some logging in Magento\Checkout\Controller\Cart\Add::execute. And check $e->getMessage() where it's doing:

$this->messageManager->addException($e, __('We can\'t add this item to your shopping cart right now.'));

@zehsergio
Copy link
Author

lets check this... wait pls

@danslo
Copy link
Owner

danslo commented Mar 27, 2018

What about exception.log? And can you upload that exception log somewhere (gist.github.com), it's hard to read here.

@zehsergio
Copy link
Author

@danslo
Copy link
Owner

danslo commented Mar 27, 2018

Are you sure you are uploading those files correctly? Because in your previous message you had an error with Magento\Checkout\Controller\Cart\Add\Interceptor, and those are missing in your gist.

I also see an error for Class ImaginationMedia\Correios\Model\ResourceModel\Cotacoes, that could be related.

What happens when you set Rubic_CleanCheckout to 0 in app/etc/config.php? Do you still get the same problem?

@zehsergio
Copy link
Author

No... when i disable the module... works OK. Add to cart and checkout.

@danslo
Copy link
Owner

danslo commented Mar 27, 2018

Then please check your logs again, because the gist you uploaded doesn't match the previous message you posted.

@zehsergio
Copy link
Author

captura de tela 2018-03-27 as 19 06 35

Looking... i change the Default Shipping Method to "Correios"

@zehsergio
Copy link
Author

@danslo
Copy link
Owner

danslo commented Mar 27, 2018

What if you temporarily set that shipping method to something simple, like flatrate? Does it solve the problem?

Does ImaginationMedia\Correios\Model\ResourceModel\Cotacoes even exist?

@zehsergio
Copy link
Author

captura de tela 2018-03-27 as 19 16 09

yes exist.... look.

It is a plugin of Correios ship to brazil.

@danslo
Copy link
Owner

danslo commented Mar 27, 2018

What if you temporarily set that shipping method to something simple, like flatrate? Does it solve the problem?

@zehsergio
Copy link
Author

i change to Flat rate in configs of clean checkout ... and not works

@danslo
Copy link
Owner

danslo commented Mar 27, 2018

In the place I mentioned earlier, Magento\Checkout\Controller\Cart\Add::execute, can you put a echo $e->getMessage(); die; where it catches the exception? So we know the exact error message.

@zehsergio
Copy link
Author

so... i dont know how to do this... can you help-me? here, https://gist.github.com/zehsergio/8ba2ff3462e069d925557450215867c9 , i pasted full code of archive ... can you put the code in correctly exception... and share with me the full code ...... and then.. i place here.

@danslo
Copy link
Owner

danslo commented Mar 27, 2018

Between line 155 and 156, after the catch (...) {, put echo $e->getMessage(); die;.

@zehsergio
Copy link
Author

Ok... done

@zehsergio
Copy link
Author

now it's like this... no load

captura de tela 2018-03-27 as 19 39 49

@danslo
Copy link
Owner

danslo commented Mar 27, 2018

Ah, that's because it's throwing this error in an AJAX request. Open developer tools (F12 on chrome), and check the Response for the add to cart request.

screen shot 2018-03-28 at 00 43 27

(notice I filtered the request on checkout/cart/add).

@zehsergio
Copy link
Author

captura de tela 2018-03-27 as 19 50 43

captura de tela 2018-03-27 as 19 50 49

captura de tela 2018-03-27 as 19 51 00

@zehsergio
Copy link
Author

permissions or something?

@danslo
Copy link
Owner

danslo commented Mar 27, 2018

Maybe 🤔

What if you deleted the contents of generated folder, and execute this command php bin/magento deploy:mode:set developer.

@zehsergio
Copy link
Author

what a generated folder? sorry.....

@zehsergio
Copy link
Author

zehsergio commented Mar 27, 2018

i can remove the echo $e->getMessage(); die; ?

@danslo
Copy link
Owner

danslo commented Mar 27, 2018

In the root of your magento directory, there is a folder called generated. Same folder as index.php, etc.

And you can leave that code in for now... If we solve the problem, it will not throw exception anymore ;-)

@zehsergio
Copy link
Author

ok .. this paste.... and I remove?? all itens? 🤔😱 shshhahhshs

captura de tela 2018-03-27 as 20 02 18

@danslo
Copy link
Owner

danslo commented Mar 27, 2018

Yeah everything, except for .htaccess. Don't worry, it's generated code... You're not deleting anything important.

@zehsergio
Copy link
Author

OK... Done.

Enabled developer mode.

and now?

@danslo
Copy link
Owner

danslo commented Mar 27, 2018

Do you still get the same error?

@zehsergio
Copy link
Author

zehsergio commented Mar 27, 2018

No.. because stay Adding..... and not complete.

the message no..... because of echo $e->getMessage(); die;

but dont works

@danslo
Copy link
Owner

danslo commented Mar 27, 2018

I mean, when you go to Response tab, do you get the same error?

@zehsergio
Copy link
Author

yes.... the same error

Class ImaginationMedia\Correios\Model\ResourceModel\Cotacoes
does not exist

@danslo
Copy link
Owner

danslo commented Mar 27, 2018

I'm not sure what to tell you :-( I installed that Correios module and set it as default shipping method in Clean Checkout. Still works just fine for me. I guess it's something wrong with loading that module. Maybe permissions, maybe something else. I'm not sure.

@zehsergio
Copy link
Author

😨.... i set the permissions .... and no works.

i install the module with composer....

@danslo
Copy link
Owner

danslo commented Mar 27, 2018

I don't think it's related to this module. The message is coming from Magento 2 (not this module) saying it can't find ImaginationMedia\Correios\Model\ResourceModel\Cotacoes. Why that is the case, I don't know 🤷‍♂️ Even when I install that module myself it works for me.

@zehsergio
Copy link
Author

hmmmmm maybe.. any config in magento... to works in brazil? maybe ship, currency, tax...... ?

@danslo
Copy link
Owner

danslo commented Mar 27, 2018

Only thing I can think of is to install that module using composer (not copy to app/code). By adding their repository to your composer.json:

    "repositories": [
        {
            "type": "composer",
            "url": "https://repo.magento.com/"
        },
        {
            "type": "vcs",
            "url": "https://bitbucket.org/imagination-media/correios.git"
        }
    ],

and then running:

composer require imaginationmedia/correios:dev-master
composer dump-autoload

After that, I'm out of ideas.

@zehsergio
Copy link
Author

ok.. i installed my module of Correios copying to app / code ... then now, i remove... and get with composer... wait

@zehsergio
Copy link
Author

look.. im install this: https://bitbucket.org/igor_lm/igorludgero_correiosofflinem2/wiki/Home

and works.

@danslo
Copy link
Owner

danslo commented Mar 28, 2018

That's weird. I installed that ImaginationMedia module and it worked fine for me. So I still suspect some environment / installation issue.

@mageuser
Copy link

I got same error when i was using cPanel, just give permissions with chown command...

@mageuser
Copy link

mageuser commented Mar 28, 2018

Do this:

rm -rf var/page_cache var/cache var/composer_home var/generation var/di var/view_preprocessed
php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy -f
php bin/magento indexer:reindex
php bin/magento cache:clean
php bin/magento cache:flush
find /YOURPATH/public_html/ -type d -exec chmod 755 {} ;
find /YOURPATH/public_html/ -type f -exec chmod 644 {} ;
chown -R YOURUSER:YOURUSER /YOURPATH/public_html/
php bin/magento cache:flush

@marceloneppel
Copy link

Hey guys. I don't use CleanCheckout, but I found this problem (Class ImaginationMedia\Correios\Model\ResourceModel\Cotacoes) too. I fixed it by changing the ImaginationMedia/Correios module di.xml file. I attached the original file (di-old.xml) and the new one (with my changes: di-new.xml). Check it @zehsergio. I will submit a pull request to the ImaginationMedia/Correios repository.

di.zip

@edward-simpson
Copy link
Collaborator

Hi,

This doesn't sound like an issue with the clean checkout module, we're making updates to this module for the latest supported versions of Magento, the module in it's current state is tested and working on 2.3.x and 2.4.x (bar a few bugs which will be fixed in a coming release). Please re-open the ticket if you continue to experience issues on supported versions of M2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants