Add sample product with price to each existing

  • Posts: 34
  • Thank you received: 0
11 years 1 week ago #155272

-- fabricsandfringe.com/cart
-- HikaShop version -- : 2.2.2
-- Joomla version -- : 2.5.20
-- PHP version -- : 5.3.28
-- Browser(s) name and version -- : ANY

My client need to add a sample at a price of $1 to each of her products. The products are uploaded from her in-house POS system so it will need to be added automatically to all products. They will need to know which product the sample is for, and extra shipping will not be charged. Can you describe the best way to do this? Thanks.

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

  • Posts: 83831
  • Thank you received: 13572
  • MODERATOR
11 years 1 week ago #155315

Hi,

What you can do is this:
Create a general sample product via the menu System>Products and set a price of $1 for it. You can put it in an unpublished category if you don't went to have it displayed by default on the products listings.
Then, create a custom field of the table "item" and of the type "text" via the menu Display>Custom fields (Business edition only) and restrict it to the unpublished category where your sample product is attached so that you don't get it on the product page of other products.
Finally, You can add a link like that in your products:

<a href="http://myshop.com/index.php?option=com_hikashop&ctrl=product&task=updatecart&quantity=1&checkout=1&product_id=XXX&data[item][YYY]=ZZZ">Order a sample</a>
where XXX is the id of the sample product, YYY is the column name of the custom field of the sample product and ZZZ is the value that you want in it for the current product (for example the name of the current product).
When the user will click on that link on a product page, it will add the sample product to the cart with the name of the product filled in the custom field and he will be redirected to the checkout in order to proceed.

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

  • Posts: 34
  • Thank you received: 0
11 years 1 week ago #155760

I'm sorry, I'm not much of a coder.
I have added a product: fabricsandfringe.com/cart/fabrics-fringe...ct/1200311568-sample
And a custom field: (I do not have an "item" table, but I have a product table. I think this name was changed to sync with their POS. Anyway, I added the text field labeled "Sample" with column name "sample"

And I inserted this code:
<a href="http://http://fabricsandfringe.com/cart/index.php?option=com_hikashop&ctrl=product&task=updatecart&quantity=1&checkout=1&product_id=sample&data[item][Sample]=product_name">Order a Sample</a>

But I'm sure I did something wrong somewhere. Could you take a look and see where I made the error(s)? Thanks in advance.

View here:
fabricsandfringe.com/cart/fabric-categor...ber-black-candy-pink

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

  • Posts: 83831
  • Thank you received: 13572
  • MODERATOR
11 years 1 week ago #155763

Custom item fields are only available in the Business edition.
It doesn't work because you need to create a custom field of the table "item" and not of the table "product".

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

  • Posts: 34
  • Thank you received: 0
11 years 1 week ago #155860

Yes, we have the business edition. I do not have a table "item" please see attached screen shot of my choices. I don't know if the table names were changed due to a custom bridge for the client's POS system.

Attachments:

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

  • Posts: 13201
  • Thank you received: 2322
11 years 1 week ago #155873

Hi,

"Yard" is not a default type, that's maybe the item one which has been renamed.
Thanks to try this type.

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

  • Posts: 34
  • Thank you received: 0
11 years 1 week ago #156080

Allright, I renamed "Yard" back to item, and created the custom field. Can you help me with my code here:

<a href="http://http://fabricsandfringe.com/cart/index.php?option=com_hikashop&ctrl=product&task=updatecart&quantity=1&checkout=1&product_id=sample&data[item][Sample]=product_name">Order a Sample</a>

I am not really a coder, so I need advice if the above is correct. Thank you so much for your help thus far.

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

  • Posts: 83831
  • Thank you received: 13572
  • MODERATOR
11 years 6 days ago #156095

That's wrong. In the product_id parameter you need to enter the product id. You entered "sample" which is not a product id. A product id must only have numbers in it. You can find it on the right column of the products listing for your product in the backend.
Also, you replaced "YYY" with "Sample" in the URL. This will only work if the custom field column name is "Sample" but normally you should not have any uppercase there...

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

  • Posts: 34
  • Thank you received: 0
11 years 1 day ago #156868

Thank you very much, it works. I only have one more request, I need to return the product name of which the "sample" is to be from. Can we append it to Sample - "Product Name" in the order form? You see, the sample is to be a swatch of any of the products, but they will need to know which product to take the swatch from. Thanks in advance for all your help.

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

  • Posts: 13201
  • Thank you received: 2322
11 years 1 day ago #156887

Hi,

Sorry I'm not sure to understand correctly what you need.
Could you give more details, example, screenshot ? :)

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

  • Posts: 34
  • Thank you received: 0
11 years 1 day ago #157003

Sure,
Each product can have a sample. When the customer orders, we must know which product they want to sample to be from.
So on the product page, (attachment 1), when the customer adds the sample to their cart, we would like to return to product category, instead of "sample" category.

When the sample is placed in the cart, we need the product name appended to the Sample name (see attachment 2) so both the customer and the client knows what product to cut the sample from.

Thanks again for your help. I will be installing yet another Hikashop cart shortly. It is my cart of choice :kiss:

Attachments:

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

  • Posts: 13201
  • Thank you received: 2322
11 years 15 hours ago #157052

Hi,

Ok so to understand correctly, you have only one product named "sample" and you need to specify the product from where the customer added the sample.

I think that this will require a plugin based on the function "onBeforeCartUpdate()", add a parameter in the url which will be the id of the current product, and then you can manage things to change the product name from "sample" to "sample of XXX" for example.

A work around could be to simply create as may samples as you have products, and specify the id of each sample in the corresponding product page. You can use the custom product fields to specify his id and get it dynamically for the url.

www.hikashop.com/support/support/documen...umentation.html#cart

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

  • Posts: 34
  • Thank you received: 0
11 years 9 hours ago #157112

Work around is not an option with thousands of products being served from POS server. So you are recommending I hire a programmer or this plugin?

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

  • Posts: 13201
  • Thank you received: 2322
10 years 11 months ago #157310

Hi,

As it is not available by default in HikaShop, yes I recommend to hire a developer for that.
You can potentially use the "commercial jobs" part of this forum to post your request.

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

Time to create page: 0.095 seconds
Powered by Kunena Forum