Custom Fields in Virtuemart allowing user to enter amounts - joomla

my question is probably simple for most but its troubling me and ive been googling for sometime now.
Im trying to create a product on this following website for a client
https://www.anigmabeauty.co.nz/index.php?option=com_virtuemart&view=category&virtuemart_category_id=1&Itemid=235
I want to create another Voucher called $100+ Gift Voucher with that voucher set at $100.00 obviously. when the viewer clicks on this I want to have a "Enter Amount" box where the viewer can enter the amount they want to pay for a Gift Voucher. for example if they wanted a $210.00 Gift Voucher, they simply enter $210.00
I managed to do this with custom fields but it then adds the amount entered (eg. $210.00) onto the $100.00 which I dont want. If it is possible I would like the $100+ Gift Voucher set to $0 dollars and whenever the viewer types in the value they want (eg. $210.00) and then go to the Shopping Cart the Total amount will be $210.00
Any help would be AMAZING
Thanks

I think you can't exactly do this with current VM without any core files modification especially cart helper and related files.
But i think you can achieve this in another way .like you are planning to provide a text box for entering the amount in front end . instead of that you can provide a list box with predefined values.This you can achieve by using the VM custom fields options .
There is one option for making a list of values for custom fields.
Hope this may help you..

Related

magento increment bundle product quantity on options page

I am building an on-line store to sale sweets. I added sweets box as bundle products. Before buying sweet, customer has to select box first. each box will have limit on quantity. for example box 1 contains 4 sweets, box 2 contains 12 etc. After selecting box, on options page, suppose I selected box 1. I selected 4 sweets. now I want to buy few more sweets. so there is a need to have an Ajax call to increment box quantity.Please help me with this. Thanks in advance.
It is my advice that you find a different way. I think you are suggesting using ajax to change the product (to a different bundle) and then move the 4 sweets from the initial bundle to the new bundle. That is a very complicated thing to do. An full answer here would need many lines of code.
I suggest you allow the user to pick the sweets first, then ask them to pick a box - the box must be big enough so you might give your box products an attribute sweets_maximum and set that to 4 or 12 and use some logic to only display boxes that are big enough.
Then maybe the cost of the sweets is zero and the boxes non-zero (so you can apply the price for the box and not the sweets).
Alternatively, load the sweet_maximum and the bundle SKUs and all the sweets skus into one webpage and after the user selects the number of sweets, write code to pass back to Magento the correct SKUs to add to the cart ie 10 different sweets SKUs and the SKU for box 2.
Bundles are very complex. I don't think you want to be ajaxing them back and forth.
*EDIT following comment below
Then this (from my answer above) is my recomendation: do everything in the browser and then pass back to Magento only the box and sweets chosen - your Javascript would form the URL to the bundle controller with the appropriate product selections.
*Alternatively, load the sweet_maximum and the bundle SKUs and all the sweets skus into one webpage and after the user selects the number of sweets, write code to pass back to Magento the correct SKUs to add to the cart ie 10 different sweets SKUs and the SKU for box 2.*
If you really want to use ajax you are going to be jumping through a lot of hoops. Here is the psuedo code I would use. You can find the functions by using the defualt Magento theme and capturing the submission URLs from the bundle pages and the cart-updates and reading the code in the controller actions.
(server side)display the chosen bundle
(browser side)UI logic to decide when a different box is needed
NO, WAIT. Maybe we need more information; it is difficult to do a full code architecture in this forum.
//new psuedo code
Carry on as normal. Allow the user to pick any box and any number of sweets through out the entire shopping experience
Eventually the user will visit its cart.
As part of the cart display logic, count the total sweets and count the total box capacity. If box capacity < total sweets, prompt the user to choose a bigger box.
Why do I say this? I mean there is a lot of shopping scenarios to work out but if you are really doing these as bundles then the bundle is not in the cart until the user presses the add to cart button - that is why I say the browser should have the logic to change the box in the browser without ajaxing anything. Can a user buy sweets separately?
I don't know what to say. I am happy to help you but we are opening a can of worms as far as the logic is concerned and without a specific list of all shopping scenarios and all allowed buying logic I find it difficult to assist. But I think if you write down all the logic you will find the answer yourself. Don't be afraid to advise your client on different ways to do this.
The URL for adding a bundle to the cart is:
POST http://54.247.95.57/checkout/cart/add/product/13831/ HTTP/1.1
product=13831&related_product=&bundle_option%5B767%5D=3867&bundle_option_qty%5B767%5D=1&
The URL for removing a bundle is :
POST http://54.247.95.57/checkout/cart/updatePost/ HTTP/1.1
update_cart_action=update_qty&cart%5B48677%5D%5Bqty%5D=0
But I still say do it all in the browser.

How to get product related information from customer when he add a product to cart?

i want to attach a form to a product and when customer want to add that product to cart he should fill in the info in this form 1st.
And that information must be attached with the purchased details.
for example
i want to get size information (like length, neck, waiste, sleaves, chest etc) from the customer when he wishes to purchase a product. and then this information must be sent with the purchased details (or may be in email etc)
How to approach towards this solution.
Right now i am using custom options for it. but this is not a good solution cuz i believe there must be better approach than that
Add a custom form module, there are free form extension in magento connect.
And then add the form into the view.phtml, add your script to enable the "add-cart" button only after submitted the form.
Is this the flow you expected?

Missing UPS Shipping Methods on the Magento Frontend

What would cause ups shipping methods that are selected in magento's shipping method admin page to not show up as shipping options to customers. Specifically I'm trying to get the ground commercial option to show up on the frontend.
I've done some research on this, it seems like this questions been asked a before and never answered (that i can find) so I'll ask it again and throw in my research on the subject.
I've traced the source code from the shipping cost estimations in the shopping cart and found that when you enter a zip code it creates an entry in the 'sales_flat_quote_address' table with basically just the postcode and id fields filled.
It also creates rows in 'sales_flat_quote_shipping_rate'. one for each applicable shipping method for that quote/address pair.
When magento lists the shipping options it references this table.
Somewhere between the shipping methods admin and this database table some of the shipping methods are filtered out.
I think it has something to do with residential/commercial addresses. However ups's rating api cant determine if an address is residential/commercial if only given a zip code. Also changing the destination type in the admin page does not have an effect on which methods are displayed on the frontend.
For reference if all ups shipping methods are selected in the back end, the following are the only ones that show up on the front end:
ground
3 Day Select
2nd Day Air
Next Day Air Saver
Next Day Air
Next Day Air Early AM
This is out of 22 options selected in the backend.
Go to System > Configuration from admin panel
In the Configuration panel on the left, under Sales, click Shipping Methods.
Click to expand the UPS section. Then set enable to yes.

Using one stock for multiple items in Magento

Ok so what I want is to have multiple simple products draw from the same stock.
Scenario
I have a sinle nail file (Stock:500)
I have a box of nail files (50/box)
I want it so that if someone buys a box then it deducts from the 500 stock of the singles. Essentially what we do is if someone buys a box, then we ship them 50 of the single files in a box.
Any easy way to do this?
This isn't a native function of Magento, so there a few approaches you can take to emulate it:
Use an external stock management package to keep track of stock and modify Magento to use that. This will require more backend modification.
Attempt to fool Magento by using product bundles in clever ways. This will require more frontend modification
Develop or find a Bill of Materials plugin for Magento. I didn't see anything after a short search, so you may have to build it. Have that module check the constituent materials for a product before allowing it to be added to the cart.
Hope that helps!
Thanks,
Joe
Consider:
Create a template for the products that you wish to order this way. This template need only be the files you need to modify, by default it will find the missing files from your default theme;
In the template you can place some PHP to write out some extra javascript, of the prototype variety;
This frontend code hides the real quantity box, with prototype 'hide' for the relevant css id to make it a hidden form field;
The code shows its own quantity box, also an extra field for how many of the fifty packs are required;
An onchange event on these boxes gets the values of the boxes, does the required multiplication and addition, then updates the hidden 'real' quantity box with (boxes*50)+singles;
On submit the customer sees in the cart the total quantity of the product ordered - this will be total units, not broken down 'per box'. If this is a problem, you can put some words to explain that or modify your main template to handle this and present to the customer the boxes+singles breakdown;
Set your products to use the 'new theme' that has your template update code.
Test, test, test!
As mentioned by Joseph this cannot be done out of the box. The above workaround is only partial, however, so long as you make it clear to customers that they are buying 500 units instead of 500 boxes then you should have a reasonable solution.

Magento Custom Field Defines Product

I am running a Magento store where someone can buy a personalized item with their name on it. Under the product, you see "Name:" with an input box where they can fill out their name. They click "Add to Cart", it ads it, I fill the order and everyone's happy.
But, in order to purchase another product with a different name, they have to go from the cart back to the product. Its a mess.
I'd like there to be a button under the "Name" field that says "Add Another". Upon click, it pulls down another field for "Name:". Now we see two name fields, I add "John" and "Joe" in the first and second fields, then click "Add to Cart".
In my cart, I now see two products added. One with Johns Name, and one with Joes.
Any and all help is greatly appreciated. I'm a Wordpress guy trying to figure out Magento!
This is not really a simple addition, but basically you'll need to modify app/code/core/Checkout/controllers/CartController.php to call addProduct for each of the items in the form. This isn't really a trivial change, as you'll have to rip apart that method to make it load the products in sequence.
Another approach would be to use an event (such as checkout_cart_product_add_after) to keep track of when an item is added and see if extra parameters were passed, adding more items as necessary.
Alternatively, you may be able to use related products to accomplish this (since they are added to the cart as well). I haven't looked at how to approach that one, but it may be worth a look.
Hope that helps!
Thanks,
Joe

Resources