Virtuemart Coupon Plugin based on quantity not value - joomla

I've had a look at available Virtuemart plugins and I can't find anything close to what I am after. This is what I need.
Allow admin user to create coupon codes. An import feature would be nice as there will be thousands but I can handle this bit if needed anyway.
The admin user selects the number of products the customer is allowed for each coupon code.
When the customer uses the coupon code they are allowed to choose any product on the website up to the total amount of products issued to the coupon. Regardless of the products price.
Nice extra would be to allow free shipping with the coupon.
I've looked at the possibility of extending virtuemart and I think it would be possible. It would however require quite a lot of changes and if I can find something that is halfway there it would help me on my way.
Thanks in advance.

OK well time was running out and I didn't get an answer so I rolled my own. It was actually fairly painless. I can't release the code but I can give you a good idea of the steps and a direction to go in.
extend vm_ps_coupon and override the update, add and process methods. Add and update should only require a change to the array that is sent to the DB. See here for more info on extending classes
Alter the enum in the database to allow for quantity as well as total and percent.
Within your new update method handle the variation of quantity to do as you need.
In the update method you can also set a flag for free shipping in a session variable.
In templates/checkout edit list_shipping_methods.php. Simply check for the free shipping flag and load the free_shipping class. You can then call free_shipping->list_rates($vars);
extend vm_ps_checkout, override the add method, call the parent add method and then check the result so you can delete the session variable for the free shipping.
Finally you will need to make some changes in the HTML. Unfortunatly i could not find a way to override this easily and since its only two small changes to the markup i just went ahead and hacked the core. If anyone knows of another way that would be great? I did see something online about using a Joomla hook and a System plugin but I'd rather keep it reliant on Virtuemart only.
In administrator/components/com_virtuemart/html/ edit coupon.coupon_form.php to show the new quantity radio button.
Then edit coupon.coupon_list.php to display the correct values. Currently it will only display percent and total.
Hope this helps someone in the future. If you need some assistance then post on here and I'll be happy to help.

Related

how to add cash on delivery charges by my custom module magento

HI I want to add some charges on cash on delivery, I dont know where to do that
what I need to extend or what observer I need to call and how I can get and update quote price can any body explain briefly to me.
Thanks in advance
Before you start thinking about code you need to describe (if only to yourself) how your new "cash on delivery" feature will work with Magento. When will users be prompted for this choice? What needs to be added to the backend order information panes? etc.
Once you know that, you can start to identify the blocks/phtml and model logic you'll need to change/add-to in order to implement your feature.

Magento Shipping Method problems

My problem is that i made ZIP Code optional, but now, if i write any number in the box, shipping methods are dissapearing .
i can write everything in the One Page Checkout, but when i get to zip code (which is optional now), and i write something, shipping methods dissaper and i try to finish order, i get
Your order cannot be completed at this time as there is no shipping
methods available for it. Please make necessary changes in your
shipping address.
If anyone knows how to solve this, thank you

How to alert Magento Site Admin about abandoned cart?

How could we alert a magento site admin about each abandoned cart immediately after it is abandoned?
Is it a default feature in Magento EE?
No it is not a default feature in Magento EE.
You ask how a site admin could be alerted of an event that is somewhat of a grey area.
Assuming that an abandon cart is defined by the following criteria (which in fact is not the definition but may be applicable to you)
A registered user (ignore guest users for sake of sanity here) has products in cart.
This user does not complete the checkout and leaves the store-front
A period of time goes by (eg 1 day) with no adjustments on the cart items
Assuming this situation is your abandoned cart scenario i could suggest the following :
1.) I would use the Magento Quote Object (this is the object that is converted to an order after a successful checkout.)
looking at the quote object there already seems like there are enough fields to be able to monitor when the quote was created, when it was updated, when it was converted and whether it was converted or not. If the object does not contain the data fields you need there is no reason why you could not extend it. See a sample snapshot :
My (naive) suggestion would be to set up a scheduled job, to run at the same frequency at which you define your "abandoned cart" scenairio (or any frequency for that matter).
The job could do something like the following :
1.) Instantiate a collection of quotes.
2.) Filter out quote's that have been converted
3.) Filter out quote's that have been created recently (less than the critria above)
4.) Filter out quote's that have been modified within the same time-frame criteria
at this point you should have a list of all quote's that have been created, perhaps been updated but not converted for the last 24hours (depending on your criteria of course).
If you get to this point, well then the rest is straight forward.
Extract the information you need from the quotes (id's names, numbers, emails etc), compile your report and email to the administrator.
it the best idea i can think of for now! i have not done this in practice...
Ofcourse you can set-up funnels and goals with Google Analytic to give you extensive information on your customers, including abandoned carts, but that doesn't answer your question.

Magento, add a custom attribute to a customer address

I'm looking for a way to add a drop down for a customer's address (during registration, editing, checkout, etc..) that indicates whether or not it is a Residential or Business address. I have spent hours going through tutorials but they are all out of date or poorly written. I have read 6 different ones telling me how to do the same thing 6 different ways. Can someone outline a simple process that you need to do in order to add a custom attribute to an address? I'm on Magento 1.6
Try something like this tutorial at Fontis: Know More About Your Customers - Adding Custom Signup Attributes
Whilst this was written for 1.3.2.4, most (if not all) is still relevant for 1.6. I've done a very similar thing by allowing a customer to choose the customer group they wish to belong to, by following these directions.
Oh, and there are some great comments on the post as well.
These tutorials should give you a good idea how to do what you want:
http://www.unexpectedit.com/magento/add-new-customer-attribute-onepage-magento-checkout
http://www.excellencemagentoblog.com/magento-adding-custom-field-to-customer-address
Best regards

how to add more simple products into configurable products using magento API

How can I simply add new simple products incrementally to configurable products?
or do I still need to retrieve the 2 original arrays of the pre-defined configurable product (getConfigurableAttributesData and getConfigurableProductsData) first, append the new arrays and set them again? Is it worked for my case just as the first-time creation?
And if the new simple product owns a new attribute / attribute options, do I also need to create /edit the attribute first before adding?
Thanks in advance!
The API as it stands does not have the functionality to do this.
Your options are:
Extend the API. (Hours of fun)
Do it with Magento methods in your own module or standalone code that includes Mage.php.
SQL script mixed in with your existing API code.
Buy someone's module - (Hope your German is good)
The approach you take also depends on your SKU naming scheme, if you have a simple BASECODE-SIZE-COLOUR type of scheme then the SQL option can work a treat, and in next to no time, but will be heavily scorned on by Magento evangelists.
That means you are probably going to have to write your own code. Here is a very useful site that should help get you started:
http://www.ayasoftware.com/
As well as being able to import configurables (by a variety of means including SQL) there are also snippets of code useful for updating superattribute price differentials. No readymade complete solution, but, you may need to roll your own anyway depending on your SKU naming scheme.
Whilst you are at it you may also want to write some code to find simple products that are not hooked up to anything when they should be, i,e. the ones with no visibility.

Resources