CalcBuilder Forum

Joomla 5 Modal not firing

User BPC2022 2024-12-14 11:41:38

Im currently updating our site and we are setting up the calculators. The calculator is working and sending the results and creating a hikashop product. However, the add to cart button and the modal window doesnt appear to be firing. The order cant be placed because you cant get to the Add to Cart button to start the order process.

Moonsoft support 2024-12-16 14:15:14

Hi,

We are trying to reproduce here. Can you please share an url (use private data in ticket) so we can check if there is any conflict or js issue at your site?.

Thanks. Regards,
Moonsoft Team

User BPC2022 2024-12-17 04:21:53

This problem is now happening on our main site after an update calculator address is https://www.bookprintingcompany.com.au/instant-quotation/books-and-magazines/perfect-bound-books

This is now very urgent as our business is now technically offline

User BPC2022 2024-12-17 04:21:53

This problem is now happening on our main site after an update calculator address is https://www.bookprintingcompany.com.au/instant-quotation/books-and-magazines/perfect-bound-books

This is now very urgent as our business is now technically offline

User BPC2022 2024-12-17 08:04:31

I dont know whether this helps. I run my sites through two different hosting companies. Both are affected by this. I turned on a site that hasnt had any changes for about 6 months and the same this is happening. All are creating a product, and none of the buttons are working. The only buttons that work are calculators which dont rely on a spreadsheet for data.

Moonsoft support 2024-12-17 09:40:55

Hi,
we have launched the calculator and we see you're facing issues related to php8 new restrictions about the operations. In php8, it's not allowed to launch a division by zero. While in previous version of php it only threw a warning, now it causes an error. So maybe at your php section of the calculator you have any operation with a division that you need to control. To confirm we have filled all inputs from the calculator to different values and then the operation finishes, but then encounters that at hikashop side it's missing some price configuration and it's unable to find the field
'price_zone_id' , we think this is the reason it can't add to the cart after creating the product.

If you're not sure on how to solve we can take a quick look at your configuration and let you know where you should adjust your settings, in order to help you with a faster solution please share an access at the 'private data' section of the ticket and we'll debug directly at your site.

Regards
Silvia Martín
Moonsoft Team


User BPC2022 2024-12-17 10:03:09

I have no idea where to start. Hikashop is not ideal to work with and I am currently looking at eshop as a alternative. However, thats for another day. I dont have time at the moment to swap them all over to eshop. If you make changes to the calculator, can you please copy the code that you change into notepad, so I can change all of them and fix them. The code varies with each printing technique and technology. Im not a coder, Im a printing machinist, so I dont have any knowedge other than what Ive googled and read on your site.

Moonsoft support 2024-12-17 14:46:34

Hi,
ok, the problem when adding to cart is caused by the latest hikashop upgrade, which includes a new field for the prices without a default value. We have already solved at your site, and the upgrade to latest version of Calcbuilder also solves in case you need to fix in another site.

Apart from this, looking at your php code for the calculator at your example url you have several operations that can cause problems when user is not entering certain form values because of the new rules of php8.

For ex if the number of impressions is 0 (and this happens for ex if the user is not selecting print size)
when you do

$expenses_unit_rate=$expenses/$impressions_rate;

it fails (division by zero). You could fix your php code to avoid such operations, something like

$expenses_unit_rate=$expenses; //default value
if($impressions_rate>0)
$expenses_unit_rate=$expenses/$impressions_rate;

or maybe set $impressions with default value =1 at line 19, it depends on your expected results using these values.


Another option without modifying code would be to force user to always enter valid values for your operations:
We have set
Validation for numeric input to be >0 for quantity_ordered field
Added css class to the book_size field, to force to select one valid option

that way you'll ensure your php code will run without unwanted inputs.

Please try from your side to confirm now it's going to hikashop cart as expected.

Best regards
Silvia Martín
Moonsoft Team

User BPC2022 2024-12-17 23:44:26

Thank you so much. You are a legend. Impression rate will never be zero, however, I will change the code. How much would it cost to get the eshop parameters done by you if I wanted to move away from hikashop. Hikashop is becoming more of a problem than a simple cart.

Moonsoft support 2024-12-19 11:19:32

Hi,
in fact as you have already the integration with Hikashop, move it to eShop won't be very complex. The only requirement is you to create a product at eShop, that will be used as a 'template' for the new ones (for ex, if you want to create it with a image, or specific parameters). Let's say this new product has the ID=1. At the end of your calculator, you'd only need to move the settings from the hikashop parameters to the eShop ones, this way:

$es_idtemplate=1; //This is the eShop template product
$es_quantity=$hk_quantity;
$es_product_price=$hk_pricehikaproduct;
$es_product_desc=$hk_product_description;
$es_product_fields=$hk_productfields; //If needed
$hk_quantity=null; //to avoid hikashop product integration

And now you should be able to change the button 'add to cart' from hikashop to eShop at the module configuration.

This should do the work, you can give it a try and let us know if you find any issue with the configuration.


Regards
Silvia Martín
Moonsoft Team

User BPC2022 2024-12-20 03:45:12

Ive tried to set this up and Im doing something wrong. Could you take a look please. Hika shop hasnt been installed so there is no conflict

Moonsoft support 2024-12-20 15:59:10

Hi,
we've checked and made following changes:

- Found the calculator was not able to find the spreadsheet to recover calculation data. Can you please check if you have uploaded the excel files to the media/com_calcbuilder folder? You can also enter the calculators and upload the file again, like we did for calculator number 11.

- When setting eshop product fields, we changed these ones (tax and shipping)


/*here eshop needs the id of one tax configured at yoursite/administrator/index.php?option=com_eshop&view=taxrates, we set 1 which is the only one we found already configured there.*/
$es_product_fields=1;
$es_product_fields=$freight_rate; //here we set the shipping cost, without format

- After the calculation, the cart was in error because a known error of the gantry template, solved as explained here:
https://rockettheme.com/forum/gantry5-for-joomla/290974-solved-compile-error-declaration-of-psr-log-nulllogger?start=0

- And finally, it shows an error when showing products or adding them to cart (not only calculator products).

Call to undefined function imagecreatefrompng()

This happens because eShop needs your server to have loaded the library php-gd, you may have an option to enable it from your hosting control panel, or, you can ask your hosting support to enable it for you

Hope this helps, regards
Silvia Martín
Moonsoft Team

...
Support/development

Perfect for small code changes or to correct any bug at your site

Buy now!
...
Support/development 10 hours

Get a bigger amount of hours for more complex tasks and get a 10% discount

Buy now!