Add to Cart Button

  • Posts: 4
  • Thank you received: 0
12 years 10 months ago #19519

Is there a tutorial on how to insert an Add to Cart button in HikaShop?

Right now, I only have a link that displays "Add to Cart" as text. I know HTML and CSS pretty well, and I've already created the button I want to use. However, I'm unable to modify the product description's HTML using the toggle editor. Every time I change something it changes right back when I save.

Thanks for your help.

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

  • Posts: 81702
  • Thank you received: 13103
  • MODERATOR
12 years 10 months ago #19528

The Add to cart button is normally generated automatically by HikaShop. You don't need to add it yourself.
If you don't see it, it's either that you activated the "catalogue mode" option of the configuration or that your product is free and the option "display add to cart button for free products" of the configuration is turned off, or that your product has a quantity of 0.

If you can't edit the product description, it's probably because of your HTML editor. In the configuration of HikaShop, you have the option "editor" where you can select another editor.

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

  • Posts: 4
  • Thank you received: 0
12 years 10 months ago #19599

I don't have catalogue mode on, the product has a price, and the product quantity is unlimited. But I still don't have a button that looks like the regular one.

However, I changed the button style from "normal" to "CSS" and I now have a button that displays. It looks different from the gray one I usually see on other HikaShop Sites. But I think I like this one better.

Thanks

Attachments:
Last edit: 12 years 10 months ago by bsmcgillis.

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

  • Posts: 81702
  • Thank you received: 13103
  • MODERATOR
12 years 10 months ago #19601

HikaShop displays the add to cart button with the default look like on your second image. However, it uses the CSS class "button" so that it adapts automatically to your template's CSS. If you see the button in blue, that's because your template CSS defined the button class like that. So if you want it to display normally, you should either:
change your template CSS to not change the button display style.
change the html of the button so that it doesn't use the button CSS class.

For option one, I can't help you as it depends on your template.
For option two, you can do that with a template override on the button display:
www.hikashop.com/support/documentation/6...tation.html#override
That way you won't loose your modifications. But if you're not a developer, that will be hard. So instead, you can just edit the file administrator/components/com_hikashop/helpers/cart.php and change the line:
$html= '<input type="submit" class="button hikashop_cart_input_button" name="'.$map.'" value="'.$name.'" '.$ajax.$options.'/>';

to:
$html= '<input type="submit" class="hikashop_cart_input_button" name="'.$map.'" value="'.$name.'" '.$ajax.$options.'/>';

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

  • Posts: 11
  • Thank you received: 0
12 years 6 months ago #28325

Hello Nicolas!

Today I had a chance to play with the Add To Cart feature as per our discussion @ www.hikashop.com/en/support/forum/2-gene...-hikashop.html#28278 . I've also had the chance to look at your developer documentation @ www.hikashop.com/support/documentation/6...r-documentation.html

My $20,000,000 Question follows next after not finding what I was looking for in your documentation.

In addition to being able to embed the Add To Cart on any website or on any Articles, how do I make the following work:

1. Using a generic Joomla Form or a form from RSForms Pro, how do I override the default form submit button and instead display HikaShop Add To Cart button and have it be what users press to invoke the submit action?

2. After users walk thru checkout process, run code that checks to make sure that a successful payment confirmation is received from HikaShop before committing all the POST data collected from the Form into the DB for saving?

All Form validation will be done client side.

Thanks in Advance,

Clifton

Last edit: 12 years 6 months ago by kleeph.

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

  • Posts: 81702
  • Thank you received: 13103
  • MODERATOR
12 years 6 months ago #28346

Mmm. Displaying "Add to cart" instead of "Submit" is just a matter of changing the name of the button in the view.
Now if you want to have both a product in the cart and the data of the form submitted at the same time it's just not possible. Maybe your form component allows you to redirect the user somewhere when the form is submitted (I think that some form components have such option) in which case you could just set the add to cart URL there so that the data would be submitted and then the user would be redirected to the add to cart URL.

After the checkout, your POST data will be lost unless you save it somewhere, in the session or in the database. Also, most of the time, the payment notification is done with a server to server notification so the data in the session would be different since it wouldn't be the session of the user but the session of the payment server.
Anyway, to do stuff when the order is confirmed, the best is to create a hikashop plugin and implement the event onAfterUpdateOrder as explained in the documentation. You can look at the history plugin's code for an example.

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

  • Posts: 11
  • Thank you received: 0
12 years 6 months ago #28350

As usual, many thanks go to you, Nicolas:)

The basic idea was to save the POST data to a session, forward the user to the Add to Cart url and upon successful processing, save that form session data to DB. From what I read, it seems the form session data would be destroyed when the payment session data hits the server?

Basically, I'm trying the hard way to do with HikaShop what I've seen Mighty Resource + Mighty Commerce do in a much easier fashion. Theirs is a payment form you activate and attach to a new content collection form when you first create it. That form always represents that particular product id and that product's add to cart is appended at the bottom of your form fields in the Joomla Front End.

My idea was to try parallel their approach by creating a custom form, have a user fill in the form from Joomla Front End and before their submitted data gets a commit into the DB, have that user pay to have that data included on the site. That is what I was referring to in my forum post yesterday as "Very Powerful Stuff!" as everything now becomes a sell-able product.

You've mentioned plugins. In your honest opinion, would it be possible for one to develop a HikaShop plugin for say Sobi2 or K2 or JSeblod that allowed for a Mighty Resource + Mighty Commerce type Add to Cart behavior?

That way, we can properly ensure that new CCK data submitted by our site visitor is only saved to DB after successful processing of their payment:)

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

  • Posts: 81702
  • Thank you received: 13103
  • MODERATOR
12 years 6 months ago #28369

I don't see why I wouldn't be possible to create such plugin.

What you can already do is to add custom item fields of the table "item" so that they appear on the product pages. That way you can create complete forms on your product pages.
Then, you can always rearrange the show file of the view product if you need to customize the display of the product page. You could come up with a product page which would like like a ticket submission form for example without too much trouble.
What's nice with that is that the data is handled automatically by HikaShop, add in the order and in the emails. Also, you can even change the price based on the data entered by the user by creating a quantity price calculation override plugin as explained in the documentation.
So for example, you could have the user enter some text to be translated and have him to pay $1 per word in the text he entered. You can go quite far with that system without doing much coding.

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

  • Posts: 11
  • Thank you received: 0
12 years 6 months ago #28395

Genius Nicolas! That is exactly what I need to do. If what you're saying goes down as outlined, then your HikaShop way of handling custom user form submissions via item fields is simpler and really rocks!

Again without coding this to death, do you know of any components that will allow me to query and get that item data out as xml or json?

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

  • Posts: 81702
  • Thank you received: 13103
  • MODERATOR
12 years 6 months ago #28423

I don't know about such thing.

However, if you click on the export button in the sales listing, it will output a CSV file which will contain all the orders information along with the products of the order and the custom item fields of these products.
It could be adapted to output it in xml or json if you wanted. But if you wanted to have it as a webservice you will need to build a component or a plugin and base yourself on that export.

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

  • Posts: 11
  • Thank you received: 0
12 years 6 months ago #28428

Awesome Nicolas! Your route is also a viable one and I will explore it for Joomla 1.5.

Otherwise, for any future HikaShop user who might run into my HikaShop items fields export situation, I did find a solution that will allow one via Joomla 1.7 branch to visually create a component that will allow you to query and export any Joomla table out as xml, json, csv etc.

That awesome component is ShellManger 1.0RC by www.dazo.it ( www.dazo.it/download/ShellManager ). You might need google translate though to figure out their site and documentation. For those on Joomla 1.5, i'm sorry but ShellManager isn't yet supported.

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

  • Posts: 81702
  • Thank you received: 13103
  • MODERATOR
12 years 6 months ago #28448

Thank you for the feedback.
I didn't know about that extension. I'm sure it could help others !

So you would have to export the table jos_hikashop_order_product with that extension to extract the custom item fields entries.

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

Time to create page: 0.096 seconds
Powered by Kunena Forum