Add unlisted product to cart
#1
Posted 18 June 2010 - 09:46 AM
Hope, everything is going well so far regarding the development of LemonStand!
I have another thing: My client wants to offer a huge amount of pictures in his shop. These pictures are to be drawn from the fotolia api and shall be presented on our shop as real products. The shop-client should be able to add those pictures to his cart as if it was a really existent product in lemonstand.
Can I add a product to the cart manually? Something like function addToCart(itemName, Price, image, etc) {}? Or can I setup a dummy product within lemonstand and use this one to add a fotolia image to the cart?
Best regards
Hauke
#2
Posted 18 June 2010 - 05:44 PM
Such a weird request ;-) Well... I think we can manage the task with a little help of API. I cannot guarantee the success or any firm dates tho, mostly because the task is large and I experience the lack of time due to soon release.
I like the idea with the dummy product. We could be split the task to several smaller tasks:
1. Displaying the image list on your website. I suppose you can do that with the Fotolia API.
2. Adding a product to the cart. Here we will need to develop a custom API handler which will add the dummy product to the cart and assign it a reference to the Fotolia image (and the image name). I don't like that images could have different prices, because we will need to develop a way of overriding the dummy product price with the image price.
3. Displaying products in the cart. That's not a complicated task. For each product in the list we will need to check whether the product is an image, and if so, display the image name and price instead of the dummy product properties.
4. Creating order items from the cart items. That is an internal API task for me. I will need to load image properties from cart items and assign them to new order items. The API should be extended to allow external modules to extend order items with extra data.
5. Displaying image products in the invoice and email notifications - here we will need to override name for image products.
6. Creating orders manually from the Administration Area - we will need to allow administrators to enter the image URL and name to the Create/Edit Order Item window.
As you can see, the task requires much API extending and developing a custom module. Most likely I will not have time for this extra work before the release (approximately the mid July). Can you implement other features on the website and wait until I have time to help you?
Thank you
Aleksey
#3
Posted 19 June 2010 - 06:19 AM
Thank you for your help! Sound awesome! I still have some things left to do, so mid July would be great!
Best regards
Hauke
#4
Posted 19 June 2010 - 05:26 PM
Today I have a better solution for your task! It is better and more consistent in many ways and we can implement it within a week. We need to develop a plugin for importing photos from Fotolia. The plugin should create real products in LemonStand. That is much better than having a single dummy product, because with real products your customer will be able to do anything he can do with other products - assign different prices, disable products, delete products and so on. Also this approach will not require any tricky front-end programming - from the LemonStand's point of view Fotolia products will be regular products.
I can create a module template for you. It will add a button to the Products page - "Import Fotolia products". This button will open a popup window where the customer can specify import parameters (we will negotiate the parameters with you). Also there will be the "Import" and "Cancel" buttons. This will not take much time for me. The import process you will write by yourself (you will need to use Fotolia API). I will create a code example in the import module for you, so you will only need to access Fotolia and fetch a list of images with their names.
What do you think? If you agree, I can develop the plugin on next week.
Aleksey
#5
Posted 20 June 2010 - 02:50 AM
absolutley great idea! Wow, I love you guys! Looking forward to the plugin then!
Best regards
Hauke
#6
Posted 20 June 2010 - 01:36 PM
Then we need to discuss some details about the image import. Actually there are only a few questions:
1. When you load a list of images with the Fotolia API, does each image has its own unique identifier? We need that in order to avoid duplicate products in LemonStand.
2. Will you have some way to download an original image using Fotolia API? We will be adding original images to product file lists.
3. How to set price for newly imported image product? I can create a price field in the Import Images popup window. The price will be applied for all new products. After the import your customer can assign prices individually on each product. What do you think?
4. How you are going to deliver images to buyers? Through the My Orders section for registered customers? Recently we extended the customer notifications feature with attachments. I can create the {product_files} email variable which you can use in the Paid order notification. The variable will attach files from products ordered by a buyer to the "Thank you for the payment" email notification.
Please let me know what do you think
Thanks
Aleksey
#7
Posted 21 June 2010 - 10:58 AM
1. http://www.fotolia.c...etSearchResults
I downloaded the php4-api-kit (http://groups.google...API/files?hl=en). There is a var in the getSearchResults-method called "media unique ID" (id) that identifies the individual image.
2. Please let me explain my customer's concept a little bit more detailed:
He does not want to sell the image itself as a file. Instead, his service is to e.g. frame the selected image or lay it on canvas. Thus, it is enough to display only a thumbnail of the image to the customer. The thumbnails' max. dimensions are 400x400px and they are delivered with the getSearchResults method. Later on, when a customer really decides for a motive and checks out the cart, the fotolia api would be used to actually buy that image ("on demand" =D). But this can be realized on my own in a simple extra module.
3. The prices should be based on the image price within fotolia. As we work with the images, we have to use the licenses->price-var (License-Type: X for extended). The ideal solution for me would be to take the price-var for the Extended License and be able to multiply it with a factor XY for my client's service. If this factor is a little bit too much to realize, maybe I can already set it up in the getSearchResults-method, that delivers the import-data.
4. No Delivery needed, see above.
I hope you understood everything:-)
Best regards
Hauke
This post has been edited by h.ziehm: 21 June 2010 - 10:58 AM
#8
Posted 21 June 2010 - 11:23 AM
Thank you!
#9
Posted 21 June 2010 - 04:12 PM
Thank you. I think I understood what is needed :-) To clarify, I will not coding any LemonStand - Fotolia communications. That is your part of the task. OK?
If you can load an image price from Foltolia, that is good. We can display the multiplication factor in the import form so your customer can modify it before he click the Import button.
Regarding the keyword data - if you can obtain it with Fotolia API, you can save it to products of course.
Well, if you agree with everything and if you have nothing to add, then I will begin. Please let me know if you have any comments.
Thank you
Aleksey
#10
Posted 21 June 2010 - 09:18 PM
Yes, Sounds good so far! And also yes: I know that it's my turn to program the import function, just wanted to make sure, all my ideas are realizeable!
Let's get this started then!
Best regards
Hauke
#11
Posted 22 June 2010 - 03:26 PM
Here is your module. It has everything you need but the import itself. Now it just creates 3 dummy products. Instructions:
1. Update LemonStand (I added some new events to the API)
2. Extract the archive to the modules directory
3. Go to the modules/ziehmfotoliaimport/classes/ziehmfotoliaimport_module.php file. You will see the import() method there.
4. Find the "Import products from Fotolia" comment. Below the comment you will see a loop which you need to replace with something real. In the loop you should load image details and the image file, and then call the import_product() function. Everything is commented, I don't think you will have real troubles with that.
The module creates the "Import from Fotolia" button on the Products page toolbar (the button is the last on the toolbar, on the right part of it). When you click the button, the plugin displays a popup window with a single input field (the price multiplier). I forgot to add one thing to the module - saving the previous multiplier value. Add this line above the "Load a category with the 'fotolia' API code" comment:
Db_ModuleParameters::set('ziehmfotoliaimport', 'price_multiplier', $multiplier);Have fun!
Aleksey
#12
Posted 23 June 2010 - 12:43 PM
Thank you very much for your help, I will dive into the code in a bit!
Best regards
Hauke
#13
Posted 23 June 2010 - 02:03 PM
Aleksey
#14
Posted 03 July 2010 - 04:12 AM
Import is working great so far. I got one question left, though: Is there a possibility to display all the categories in a single dropdown-field like it is done for the Price rules in a simple way? I looked through the existing code-fragments but to be honest: I didn't get the process to show the categories. Also: Can the search-engine extended to search for meta-keywords? Or would it be better to write the fotolia-kewords into the short description field?
Best regards
Hauke
This post has been edited by h.ziehm: 03 July 2010 - 10:31 AM
#15
Posted 03 July 2010 - 06:56 PM
I added the as_options() static method to the Shop_Category class. This update is not published yet. I'm going to publish new updates today.
You can use this method to display a category drop-down list in the import form in the following way:
<li class="field text full">
<label for="import_category">
Category <span class="required">*</span>
</label>
<div class="fieldContainer">
<select name="import_category" id="import_category">
<?= Shop_Category::as_options() ?>
</select>
</div>
<div class="clear"></div>
</li>The code creates a category drop-down control. The as_options() method has an optional parameter - a category identifier to select by default. So you can store previous selection (as we store the price multiplier) and then auto-select the category next time when a user opens the form.
Regarding the keywords - we updated the search engine and now it allows to search in the product META keywords field. You will need to enable this feature on the Settings/eCommerce Settings page (see the screenshot). We will publish this update along with the Shop API update.
Thank you
#18
Posted 03 February 2011 - 02:00 PM
I have a similar request to this one. What my client is looking for is a way to add a product to the cart from outside LS. What I envision is this:
* Create a special link of some type: http://domain.com/store/addtocart/638 (where 638 represents the part number in LS)
* Place link outside LS (say on a wordpress page)
* User clicks link
* Above link is loaded, processed by adding part #638 to the cart
* LS forwards user to the Cart
Doable?
#19
Posted 03 February 2011 - 03:36 PM

Help















