Intergration Moonsoft Calcbuilder extended

  • Posts: 9
  • Thank you received: 0
7 months 3 days ago #301708

-- url of the page with the problem -- : www.atlasacomfa.nl/nl/alumon-calculatie
-- HikaShop version -- : 4.0.1
-- Joomla version -- : 3.9.1
-- Browser(s) name and version -- : Firefox 64.0

In the Calcbuilder Extended extension of Moonsoft we have setup a price calculator which is integrated with Hikashop.

With the hikashops codes like '$hk_product_name' , '$hk_product_description' and $hk_pricehikaproduct we are able to give the correct data to the hikashop checkout. These codes are put in the PHP section of the Moonsoft Calcbuilder

Is it there a way to give a picture to the hikashop checkout?

Th moonsoft support gave the next information: "It's not possible to send and image to the new product from the calculator, as the image file is stored by hihaskop in a different table." and "You could try to create a new custom field at hikashop side 'image' attached to the product and ask hikashop support if you could fill it with an html tag from the calculator, "<img src='yourimagehere.png'>" but we suggest to check with hikashop support first if this would work when they show the product at the cart."

Please Log in or Create an account to join the conversation.

  • Posts: 66339
  • Thank you received: 9733
  • MODERATOR
7 months 3 days ago #301712

Hi,

The image is not stored in a different table. The image path is stored in the same table. It's only the image data which is stored in the upload safe folder. And this requires the data of the image to be passed in $_FILES.
However, I don't know how the data is given by the calculator to HikaShop. It is done with a redirect to the add to cart URL of the product ? In that case, that won't be technically possible. Or is the add to cart done in PHP and then the calculator redirect to the checkout ? In that case, the calculator could store the image data in the correct folder and store the image path in the table like it does with other custom fields and it would work.
I'm afraid you'll have to check with them again with the additional information I gave above :/

Please Log in or Create an account to join the conversation.

  • Posts: 9
  • Thank you received: 0
7 months 3 days ago #301733

I have posted your reaction on the Moonsoft forum: www.moonsoft.es/forums/2-cbsupport/4139-...he-hikashop-checkout .

I will let you know when they have given a reaction. Or you can participate directly on the Moonsoft forum if you like.

Regards,
AdK

Please Log in or Create an account to join the conversation.

  • Posts: 4
  • Thank you received: 1
7 months 3 days ago #301744

Hi,
I'm Guillermo from Moonsoft support, we think this issue should be handled here as we're the ones asking for help about hikashop :) .

The workflow for this specific case is: the calculator adds product information to the table #__hikashop_product. Then redirects (using as you say, add to cart url) to the checkout. When we see images stored for a product in hikashop, we find the information inside the table #__hikashop_file instead, this is the 'other' table we mentioned. Or we're wrong and there is any other way to set the product image using only the product table?

As the calculator is not ready to manage the #__hikashop_file table by default, we suggested our user to confirm with you if any valid html tag, like an img with valid absolute url for ex, could be stored on a product custom field, so we can update it easily at #__hikashop_product table. as we were not sure if every part of the system, checkout, invoices, etc, will show properly this kind of information.


Thanks
Regards

Please Log in or Create an account to join the conversation.

  • Posts: 66339
  • Thank you received: 9733
  • MODERATOR
7 months 3 days ago #301753

Hi,

Ok, I didn't had the full picture and I thought that the product was already in hikashop_product and that what the calculator was doing is adding that product to the cart and trying to add an image along with it.
I was thinking about something like selling a custom tshirt where the customer can enter his own image, and so in that case, it's better to use an existing product and add the data from the calculator in the hikashop_cart_product table using custom item fields:
www.hikashop.com/forum/2-general-talk-ab...-product-fields.html

So if you add a product to the hikashop_product table, the image of the product is indeed in the hikashop_file table. However, it's potentially possible to create a custom field of the table "product" and of the type "image" or "ajax image" (hikashop Business) and store the path of the file in the column of that custom field in the hikashop_product table and store the image data in the upload safe folder. That way, HikaShop can display the image along with the product (in the emails, the order, the checkout, etc) based on the display settings of the custom field. I'm thinking that might be the best solution if you don't want to manage the hikashop_file table.

Please Log in or Create an account to join the conversation.

  • Posts: 9
  • Thank you received: 0
7 months 2 days ago #301774

I have created a custom field of the table "product"of the type "image". I have set all the display setting on "YES".

The only thing which is not totally clear for me is: "store the path of the file in the column of that custom field in the hikashop_product table and store the image data in the upload safe folder."

I do not know how to do this with the right PHP coding but maybe Moonsoft can help me with that.

Regards,
AdK

Please Log in or Create an account to join the conversation.

  • Posts: 4
  • Thank you received: 1
7 months 2 days ago #301797

Hi,
yes, that would be the best solution indeed. Create the custom field at hikashop side typed image as suggested, and then you can fill it from your calculator using the image name. I think we can go back to calcbuilder forum now, we can point you to a specific tutorial there in case you need further help to configure the calculator logic.
Many thanks to hika support for the prompt response.

Regards
Guillermo

The following user(s) said Thank You: nicolas

Please Log in or Create an account to join the conversation.

  • Posts: 9
  • Thank you received: 0
7 months 1 day ago #301818

I have not succeeded to show the image defined by Calcuilder in the Hikashop checkout.

I am not sure if I did everything right, maybe I have made a mistake at the hikashop side so that is the reason why I post the enclosed attachment here. I

In the attachement you can see at the left hand side the screens generated by Calcbuilder at the URL www.atlasacomfa.nl/nl/alumon-calculatie

In Calcbuilder a image is defined and I want to show this image in the Hikashop checkout as shown in the right hand side of the attachment.

Below you can see the custom field which is created. Are the configuration and settings correct?

What am I doing wrong?

Best regards,
AdK

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 66339
  • Thank you received: 9733
  • MODERATOR
7 months 1 day ago #301828

Hi,

There is no way that you'll be able to easily display an image from a custom field instead of the image of the product.
That will require some coding of view overrides ( www.hikashop.com/support/documentation/1...-display.html#layout ) of the show_block_img for the image on the left of the product page and of the show_block_cart view file for the checkout.
For example, for the show_block_cart, you could add some code like that:

if(!empty($product->alumon)) $img->url = $product->alumon;
before the line:
echo '<img class="hikashop_product_checkout_cart_image" title="'.$this->escape(@$image->file_description).'" alt="'.$this->escape(@$image->file_name).'" src="'.$img->url.'"'.$attributes.'/>';
In fact, if you do it like that, you could even use "text" type field, since you don't have the image in the upload safe folder of HikaShop as I said you should so that the custom field system can display the image by itself (but not in place of the product image).

Please Log in or Create an account to join the conversation.

  • Posts: 9
  • Thank you received: 0
7 months 1 day ago #301834

The suggested code for the show_block_cart is working. Thanks for this solution!

Can I use the same code for the show_block_img? And where do I have to place it?

Best regards,
AdK

Please Log in or Create an account to join the conversation.

  • Posts: 66339
  • Thank you received: 9733
  • MODERATOR
7 months 18 hours ago #301835

Hi,

Instead of $product it should be $this->element but the rest should be similar yes. and you can place it before the line starting with "echo '<img class=" there too.

Please Log in or Create an account to join the conversation.

  • Posts: 9
  • Thank you received: 0
7 months 6 hours ago #301862

Thanks for the reply.

I am an absolute beginner in PHP coding so I am not sure if I have understood everything. I have to parse the next code in show_block_img :

if(!empty($this->element->alumon)) $img->url = $this->element->alumon;

But I could not find any line beginning with "echo '<img_class="

Best regards
AdK

Please Log in or Create an account to join the conversation.

  • Posts: 9
  • Thank you received: 0
7 months 5 hours ago #301872

The only line containing the code "echo '<img" is

if(!$this->config->get('thumbnail')) {
	if(!empty ($this->element->images)) {
		echo '<img itemprop="image" src="' . $this->image->uploadFolder_url . $image->file_path . '" alt="' . $image->file_name . '" id="hikashop_main_image" style="margin-top:10px;margin-bottom:10px;display:inline-block;vertical-align:middle" />';

Regards,
AdK

Please Log in or Create an account to join the conversation.

  • Posts: 66339
  • Thank you received: 9733
  • MODERATOR
6 months 4 weeks ago #301877

Hi,

No it's that line:

$html = '<img id="hikashop_main_image'.$variant_name.'" '.$attributes.' title="'.$this->escape(@$image->file_description).'" alt="'.$this->escape(@$image->file_name).'" src="'.$img->url.'"/>';

Please Log in or Create an account to join the conversation.

  • Posts: 9
  • Thank you received: 0
6 months 4 weeks ago #301895

Perfect! Thanks a lot, it is working now.

There is only one little thing left which is not so important but I will mention it any away.

When you change the number of articles and you click on refresh the image will disappear. See attachment.

The image appears again when you refresh the page with the refresh button of your browser.

Best regards
AdK

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 66339
  • Thank you received: 9733
  • MODERATOR
6 months 3 weeks ago #301917

Hi,

I'm not sure why it would do that.
Do you still see the img tag there if you look at the HTML of the area after the refresh ?
If so, what is the URL of the src attribute ?

Please Log in or Create an account to join the conversation.

  • Posts: 9
  • Thank you received: 0
6 months 3 weeks ago #301988

Hi,

The img tag is still there. The only difference in the HTML aera is the code

::before

See enclosed screenshots.

Best regards,
AdK

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 66339
  • Thank you received: 9733
  • MODERATOR
6 months 3 weeks ago #301991

Hi,

Since the HTML is there, it means that there is some CSS code hiding it. Check the CSS of the HTML img tag with the browser inspector or maybe its parent, or its parent, etc until you find which one is being hidden by the CSS.

Please Log in or Create an account to join the conversation.

Time to create page: 0.094 seconds
Powered by Kunena Forum