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

An exception has been thrown during the rendering of a template #1125

Closed
jubbot opened this issue May 4, 2024 · 12 comments
Closed

An exception has been thrown during the rendering of a template #1125

jubbot opened this issue May 4, 2024 · 12 comments
Labels

Comments

@jubbot
Copy link

jubbot commented May 4, 2024

Currently running 3.2.1 version on both local machine and shared hosting. After I deploy my work to the live server and refreshed the home page and saw this error. Can anyone guide me to how to fix this error? It has something to do with shipping price?

An exception has been thrown during the rendering of a template ("Brick\Money\Money::ofMinor(): Argument #1 ($minorAmount) must be of type Brick\Math\BigNumber|string|int|float, null given, called in /home/retracted/public_html/plugins/offline/mall/classes/pricing/records/ShippingRecord.php on line 68") in "/home/retracted/public_html/themes/retracted/layouts/single-tab.htm" at line 4.

@SamBrishes
Copy link
Collaborator

Hello,

thanks for reporting this issue and sorry for the long wait.

Please share the code from the template file (themes/retracted/layouts/single-tab.htm) that is displayed in the exception message, so that I can narrow down the error more precisely.

Thanks.

Sincerely,
Sam.

@SamBrishes SamBrishes added the bug label Jun 2, 2024
@ARL-Steve
Copy link

Hi,
The same issue seems to be affecting my site as well. I upgraded my site at the weekend and have since been having the same error message when viewing a product. When checking the shipping settings page on the backend that also throws an error
ErrorException: Attempt to read property "code" on null in /var/www/vhosts/*****/httpdocs/plugins/offline/mall/classes/traits/PriceAccessors.php:87

It looked like there was an issue with the shipping method currency check. Since all of the products I have listed are virtual I removed all the entries in the offline_mall_shipping_methods and this removes the errors for me.

@SamBrishes
Copy link
Collaborator

Hello,

you upgraded your site... which OC and Mall versions are you currently using?

@ARL-Steve
Copy link

The previous and upgraded to versions are below.
OC 3.5.15 -> 3.6.22
Mall 3.0.25 -> 3.2.1

As I mentioned, once I removed all the entries from the shipping methods table on the database everything seems to work as intended.

@jubbot
Copy link
Author

jubbot commented Jun 4, 2024

Sorry for the late reply. I am currently on

OC 3.6.22
Mall 3.3.0
User 3.0.4

When I tried to create product sample I received this error after clicked create button. I tried migrate and refresh the mall plugin database and this error remain the same.

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'williamthomas-data.offline_mall_index' doesn't exist (SQL: select * from `offline_mall_index` where (`index` = products and `product_id` = 1 and `variant_id` is null and `is_ghost` = 0) limit 1)" on line 760 of C:\laragon\www\williamthomas.au\vendor\laravel\framework\src\Illuminate\Database\Connection.php`

@SamBrishes
Copy link
Collaborator

@jubbot Seems like your database is corrupted, at least the OFFLINE.Mall related tables. How did you tried to refresh the Mall Plugin? The correct way should be php artisan plugin:refresh OFFLINE.Mall. Has this command run through completely or has an error occurred?

Can you confirm, that the offline_mall_index table is not present in your database? If yes, is there even a single offline_mall_ table in the database?... If no, can you please change the index driver from MySQL to Filesystem (October Backend -> Mall -> Configuration -> Index driver) and try again.

Which database system are you using?

@jubbot
Copy link
Author

jubbot commented Jun 4, 2024

Dang I hope we can repair my database?

I have tried php artisan plugin:refresh OFFLINE.Mall the command ran through completely and I had to create the AUD currency and tried to create new product sample but the error remain.

Confirmed that the offline_mall_index table is not present in the database and yes there is offline_mall_ table in the database. I am using MySQL

@SamBrishes
Copy link
Collaborator

SamBrishes commented Jun 4, 2024

Seems like the offline_mall_index table isn't (and has never been) created by the migration process, but by the index command php artisan mall:index. Can you please run this instead and check if the table exists / the error disappears.

@jubbot
Copy link
Author

jubbot commented Jun 4, 2024

I have ran the index command and the error goes away so many thanks. Is there any further checks I need to perform before deploying the core oc and plugin updates to the live server. The question I asked is that I am worry that if after deployment completed the live server that hosted personal website generate bunch of errors that I am not familiar. The live server is using

OC 3.6.18
User 2.1.0
Mall 3.2.1

@SamBrishes
Copy link
Collaborator

SamBrishes commented Jun 4, 2024

This depends on how you deploy your website.

You can test with php artisan mall:check if OC.Mall is configured correctly, but of course, this doesn't check for any possible errors. I'd recommend creating a backup of your database, and - if you aren't using GIT for your web-project - of your current root directory (except vendor and node_modules folders). This way, you can at least rollback if any error occurs.

Anyways, I've updated two projects (with similar configurations) last night simple following the commands

php artisan october:update
php artisan plugin:install rainlab.userplus (Upgrade to v2)
php artisan plugin:install rainlab.user (Upgrade to v3)
php artisan plugin:install offline.mall (Upgrade to v3.3)

and nothing 's broken... yet. (Using plugin:install instead of composer update ensures that all "new" or "updated" plugin dependencies are installed as well).

So, if you don't have any wild plugins or scripts on your website, it should work fine.

PS.: You may should call php artisan mall:index on your live server too, just to make sure indexing works (it doesn't break anything either).

@jubbot
Copy link
Author

jubbot commented Jun 4, 2024

I have typed php artisan october:update and no errors generated afterward. I than deploy the update to the live server without hiccups. The live website is running as per normal. Previously I saw bolded text plugins available for upgrade but was hold back due to other plugin that relied on previous version which I tried to upgrade which broke my website. So I learnt to be patience for plugin developers to catch up to make their plugin coexist to latest version of plugin that they depend on.

@jubbot jubbot closed this as completed Jun 4, 2024
@jubbot
Copy link
Author

jubbot commented Jun 4, 2024

The solution provided by SamBrishes helped me distinguish the errors I encountered.

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

No branches or pull requests

3 participants