While uploading a file you may want to check if a file already exists in target directory then create a new file instead of replacing and rename new file with an incremental no. Example some_dir/some_file.png already exists, and you try to upload a file with name some_file.png again, so it should be uploaded as some_dir/some_file1.png … Continue reading Rename a file if same already exists
Some time you need to perform some tasks before the contact form 7 is submitted but there is no easy way to do that to stop submitting the contact form for some time. For example, you want to wait for an ajax request to respond before submitting contact form 7. Here is the workaround. 1. … Continue reading Manually submitting contact form 7 (ajax) and adding extra fields
Stripe is getting popular as a payment processor because of its simplicity and PCI compliance. To meet with PCI standards your website shouldn't send or store any credit card information to any where other than stripe, so to send credit card information directly to stripe we use stripejs. How it works Stripe.js collects credit card … Continue reading Integrating stripe using stripe.js and stripe-php library
Uncaught StripeErrorInvalidRequest: Amount must be at least 50 cents Stripe expects amounts in cents/pence, so if you pass amount as amount = 10 This will be considered as 10 pence instead of 10 USD. So when Stripe gets pence lower than 50 it generates that error. How to send USD instead of pence You need … Continue reading Stripe error Amount must be at least 50 cents
Setting up cron Crons can pass parameters or arguments to scripts as well for example you have example.php set as cron like below Now if you want to pass parameters to example.php in cron you can do it as follow by using key value pairs If you want to send arguments without keys you can … Continue reading Passing arguments to cron and receive in php
Fatal error: Unsupported operand types in /app/code/core/Mage/ImportExport/Model/Export/Entity/Product.php on line 873 If you are getting above error while exporting products in Magento 1.7.X The fix is simple. Open this file /app/code/core/Mage/ImportExport/Model/Export/Entity/Product.php and go to line number 873. It should be working now.
Being a web developer I often need to send emails based on user requirements, some time these are simple emails but some times users want to take control of email contents and attachments. To make it easier for me and other developers I have created a mail library which can be easily switched to php … Continue reading Sending emails based on templates and placeholders with attachments using php and smtp