How to send coupon code to user when register account in opencart - opencart

How can I email a coupon code to new customers when they register on the Opencart website?
i have set
Customer Login=yes
on the coupon section. When customer register it doesn't contain any coupon code.

The easiest way possible to do this would be add the coupon code to the registration mail language files. Look at catalog/language/english/mail/customer.php and edit the text of one of the variables. For example:
$_['text_thanks'] = 'Please use coupon code XXXXXX at checkout on your first order. Thanks,';
You could also add a new variable, and update the controller and template if you want more control over how and where it's displayed, but using one of the existing variables would be much easier in my opinion.

Related

Saving the city of an unregistered user. Django

I want implement feature: saving the city of an unregistered user in my django app.
Example
I visited the site for the first time. And chose my city. (not registerd)
I visited the site for the second time. Site identified my city.
How can I do It with django?
P.S. Could you please recommend articles or materials?
Example of the site https://edadeal.ru/
(you can chose city in the top right corner red text)
Have the user enter their postal/zip code first, in a popup.
Then, I would use a webservices API like EZCMD.com
to get a list of nearby cities, which the user will then select based on their postal code.
Then store that list in a cookie along with an anonymous user unique token. When the user comes back to the site, check for the cookie.
Check the token against your database for people who have visited the site and entered their postal/zip code.
To get the list of cities to put in your form you can do something like:
$.getJSON('https://ezcmd.com/apps/api_geo_postal_codes/nearby_locations_by_zip_code/GUEST_USER/-1?zip_code=90210&country_code=US&unit=Km&within=5', function(data){
//extract the data you need for your form here. This API might be best for the US,
//don't know about Russia.
console.log(data);
});
See jsfiddle to play with the API.
You can use this to set a cookie
Use this to set a unique token
I would recommended reading this question to understand how to retrieve IP address and location via GeoIP. This can then be stored as part of a model within the db.
You could get the code to check the db to see if the IP has previously appeared and if not then store it with the associated city.

How can i confirm a database entry in django admin?

I have been working around this problem. I have a user submitting a HTML form lets say to list their hotel on my website. I need to review this form before i add it into my hotels model to be published.
One approach i have worked on is to use a requests model where this form can be stored and later using django admin action write a custom action to add/remove the request. In case of acceptance i copy the details to my hotels model else it sends an email or a notification back to user.
Second approach is simply using django action on hotels model where the request is sent to approve it or reject it. In this case i want to know if thats possible where a data point doesn't get written to database until it's been accepted by admin. If yes how can i do that?
Finally, these details are displayed on my main page and search page for users to book these places.
If there is a better and effective way to do it. Please share that.
Thanks in advance. If something isn't clear i can answer your specific questions in the comments below 😊.
Have a nice day.
You can have is_published Boolean field in your hotel model and you can default it to false initially. After you inspect the hotel details you can set the is_published field to True from django admin.
So now whenever you are querying for hotels to show on your website. You can query
Hotel.objects.filter(is_published=True)

how to customize payment method in abantecart

I am new to abantecart. i need help with customising the payment method. On clicking on the checkout on the cart page, i'd like to go to a page with a form which the user should fill some payment information (this serves as the payment method). Then an email should be sent to the store owner for approval and when approved an email should be sent to the user on the approval status. Please how can i achieve this?
The best to create new payment is using of AbanteCart Developer Tools.
Just download pack, unpack some of subdirectories (for v.1.2.9 and you should use "1.3" folder) in to your "extensions" directory, then go to admin and install it. Then generate new project with extension type "payment".
You can look into default_pp_standart extension and use it as example to create your custom payment form.

Does Django store information about who has edited and/or created a record, and if so, where?

Django has an authentication and authorization scheme baked in ('django.contrib.auth') as well as modelforms to generate forms for easy input of data into the database.
I'd like to be able to record who created a record, leveraging django.contrib.auth, with the explicit purpose of limiting editing of that same record to just that user and/or people with an "edit" permission. I know that I could use the #user_passes_test decorator to restrict access to editing my record in some fashion, but I don't know what I would compare the request.user.name to in order to determine if the current user originally created that record.
How much of this do I need to roll on my own? Do I need to capture the name author, save it to the model, and then read it - or is there something already in the framework that would do this for me?
And, if I was to attempt to save the author in a field, how would I go about doing that in such a way as to not let the user edit their own credentials?
There are a couple of apps to do something similar, please check https://www.djangopackages.com/grids/g/model-audit/
About the last questions, to prevent the user not to edit its own credentials, you can mark the field with editable=False so it wont appear in the admin or ModelForms.

How to set a contact's job title in Dynamics Nav 2009 using webservices

There are two webservices, which I've tried to use
page 5050 Contact Card
page 5055 Name Details
First service handles contacts and it's possible to set contact's name. However, in RTC there is a assist button in the Name field, so it's possible to fill in additional fields for name, such as
Salutation Code
Job Title
Initials
First Name
Middle Name
Surname
Language Code
All these fields are listed in page 5055 webservice, but I can't understand how should I add a new record and link it to existing contact.
One solution I've found is to create a new page on basis of respective table and select all needed fields, in this case, Contact_No. Afterward this page can be published as webservice.
Cons of this solution, is that you need to create a new page, which requires dev license.