CalcBuilder Forum

Hikashop - can't get Calculate button to show, or any calculations to happen

User moon_998 2017-06-23 21:45:20

Hi all,

I've just bought Calcbuilder Extended for use with Hikashop with the CBPlugin and I'm having problems.

I really can't get any calculations happening at all, despite going through the tutorial.

We print labels by the sheet, and we need an easier way for customers to figure out how many sheets they have to order.

For example, one product sheet has 32 labels on it, so to order 200 of those labels would mean they would need 7 sheets.

So I set my code up like so:

//Tag count per sheet field is in the product table, and is input by us in the backend (32 in this case). It should not be visible to the customer
$sheets=$tag_count_per_sheet;

//Total Number of Tags is entered on the front end by the customer, and this number divided by the Tag count per sheet (and rounded up to next integer) would give us the total quantity
$hk_calculatedqty=ceil($totalnumberoftags/$sheets);

//Here I try to calculate the price based on the above input
$hk_calculatedprice=20*(1-$hk_calculatedqty/100);

I also have this code afterwards:

//QTY
$hk_quantity=$hk_calculatedqty;
//NAME
$hk_product_name='32 3 x 1.5 Tags';
//LONG DESCRIPTION
$hk_product_description='32 Tags';
//PRICE
$hk_pricehikaproduct=hk_calculatedprice;
//CODE
$hk_product_code='32_labels';


Things I'm seeing:

1. I don't see a "Calculate" button at all on my product pages. "Hide Calculate button" is set to NO in the calculator preferences. How do I get the button to show?

2. "Calculated price" and "Calculated price control" show up but do not do anything. I know the tutorial says they should be activated for front-end, but I really don't need "Calculated price control" there anyway. Plus, they are in the wrong part of my add-to-cart column. Can I move these?

Anyway, hopefully someone can tell me what exactly is going wrong here. Thanks.

Moonsoft support 2017-06-24 09:58:51

Hi,

We've checked your code and we found some points that need to be adjusted. Seems you have included at the same time two different ways to integrate hikashop (inside and outside of the product page). The only configuration you need is explained here:
- https://www.moonsoft.es/easyblog/entry/52-calcbuilder-extended-price-qty-calculator-integrated-in-hikashop-product-use-of-cbplugin
- https://www.moonsoft.es/easyblog/entry/53-calcbuilder-extended-calculator-integrated-in-hikashop-product-using-and-saving-product-parameters

Without testing the code we can see you need to use:

$sheets=$productData->tag_count_per_sheet;

in order to have your internal custom field for calculations. The extra code:

//QTY
$hk_quantity=$hk_calculatedqty;
//NAME
$hk_product_name='32 3 x 1.5 Tags';
//LONG DESCRIPTION
$hk_product_description='32 Tags';
//PRICE
$hk_pricehikaproduct=hk_calculatedprice;
//CODE
$hk_product_code='32_labels';

is not needed as it should be used to integrate an external calculator to create a new product.

If you also get weird results at the front view like 'Calculated price control' showing, we may suspect there is also any kind of javascript error or conflict. If you place a private ticket at the helpdesk sharing your url, we'll take a look and let you know how to fix.

Regards,

User moon_998 2017-06-25 22:23:21

Ok thanks, I have now filed a ticket with the link information included.

...
Support/development 10 hours

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

Buy now!
...
Support/development

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

Buy now!