How to change name of Payment Module that shows up in VirtoCommerce storefront - virtocommerce

Trying to change the name of the payment module that shows up in the storefront UI: "Authorize.Net payment gateway" - We would like it to simply say "Use credit card."
I have changed the module.manifest file, and I have changed the "Name" in the authorizeNetPaymentMethodFactory. The new module is properly installed but the end user UI does not change. Please provide step-by-step insight on how to change the string that shows up when a user is selecting payment method on checkout, or post-order payment screen.
We have installed the new module. Done restarts of both the admin appPool and the storeFront AppPool. We've done uninstalls, restart, upload new module to modules directory, new module shows up, new version #, etc. but end user text never changes.

Best way to override display name, use Storefront Resource File and paymentMethod.code as part of the key.
For example
'checkout.payment_method.AuthorizeNet.display_name' : 'Use credit card'.
And slightly change the code when you display Payment method name
https://github.com/VirtoCommerce/vc-theme-default/blob/521f9e073301f63bab368e16f913a51a40d194ff/assets/js/common-components/paymentMethods.tpl.liquid#L11

Related

How to enable module in another module in Prestashop 1.7?

I try to display some additional information on the top of website, if is logged user not only an ordinary customer, but also a seller (we use the module "marketplace" by Webkul).
The module "ps_customersignin" shows only a name of logged user and the button for log out on the website. But I want to display more information (link to a seller's special menu, if is the user also a seller, if not, just display user's name and the log out button).
vs.
I tried add this code in ps_customersigning.tpl, but without a result:
{if $is_seller == 1}Display additional info + name and log out button{else}Display only user's name and the log out button
{/if}
Do you have a tip how call information from the module "marketplace" to the module "ps_customersigning" for check, if the user is also the seller and than display the additional information?
You can have an instance of the marketplace module inside the ps_customersignin module by using
$marketplace = Module::getInstanceByName('marketplace');
inside ps_customersignin main module PHP code.
Then you can access the required $marketplace method / properties, assign $is_seller variable with $smarty->assign, and display your content inside the ps_customersigning.tpl

New module for personal collection/receive with possibility to choose shop (pickup to store)

I want to add possibility for clients to receive orders personally in one of our shops. I tried to find some module which gives possibility to select in which shop they want to receive order but I haven't found anything for free. Because of that I want to create new module for it. What's more I'm totally new in prestashop and I don't know where to start or how to create this module. I spend two-three days reading how to do it and these are my assumptions:
New carrier module can be created by extending CarrierModule class.
I read some articles / documentation about hooks.
I have created my first carrier module by editing module attached in this article http://www.prestashop.com/blog/en/carrier_modules_functions_creation_and_configuration/.
What I achieved is that I installed module and used hook 'BeforeCarrier' to add some layout to page after selecting my carrier.
This is how my carrier should work:
It should be a part of carrier list so customer is able to select it.
If carrier is not selected nothing hapens. If carrier is selected by customer then button 'Choose shop' should be shown.
After pressing button 'Choose shop' new window should be show with addresses of our shops (instead of new window it may be placed somewhere in current page).
Window with shop adresses will contain list of addresses with radiobuttons and button to confirm selection.
After confirmation of selection window will be closed and address should be shown as a part of carreir.
E-mail with confirmation will contain information in which shop customer can collect order.
Suppose that addresses will be hardcoded in php code.
These are my questions:
I created new carrier module so I assume it works correctly (as described here http://www.prestashop.com/blog/en/carrier_modules_functions_creation_and_configuration/).
How to add new button 'Choose shop' near selected carrier?
Can I use hooks to add 'Choose shop' button?
Where should I remember choosen shop address? Has 'Carrier' class place for it?
How to add shop address to e-mails? Should I edit layouts? Does e-mail layout contain place for it or do I need to add new 'placeholder' for it?
How to show chosen address on admin side?
To describe my problem more detail I have created few scenario (see attachment).
I will be greatful for any help.
I've posted the same question on prestashop forum.
These example are usually old and poorly written. They lack structure. But for your purpose I suppose they're ok.
Use hookDisplayCarrierList($args). Check $args to see which carrier has been selected, then return <select> element which you
shop addresses. This hook is triggered every time a user selects a carrier and is return via Ajax. Therefore, you may not use ajax here.
You should include you javascript in a file. Use hookDisplayHeader to detect when to insert this file into your page:
public function hookDisplayHeader(){
$propExists = property_exists($this->context->controller, 'php_self');
if($propExists){
$controllerName = $this->context->controller->php_self;
if(in_array($controllerName, array('order', 'order-opc'))){
// $this->context->controller->addJS($this->_path.'js/customcarrier.js');
This Javascript file should check whether a valid shop has been selected before going to the next step;
Because your Js code is in a file and the hookDisplayCarrierList cannot contain any JavaScript (because it returns Ajax),
you should also make use of hookDisplayBeforeCarrier. Here you could insert you custom carrier ID - this way you'd know
when to check for errors with your JS file.
Same question as #2.
The correct way to save the information would be to add a model. CustomCarrierSelectedAddress - or something like it.
It would have these columns: id_cart, id_shop_address;
The way you implement shop addresses is up to you. You may define them as constants or even make a new model for them.
Models arent that hard to create, you just need to declare class properties, static variable $definition that's it.
You may add you own methods. You should also add createTable()/dropTable() methods for convenience.
This is more complicated. You could:
Send your own email about selected shop address.
Search the controller method which send the email you wish to change.
Then you should override that method by copying the file to your module, delete all the other methods and
rename the class definition inside -> class AdminAddressesController extends AdminAddressesControllerCore
There should be an array of email placeholders and their values, which the controllers assigns.
for example '{order_id}'. You should add your email variable to array {chosen_shop_info} and assign whole
paragraph of text to it. Then you may use it in the actual email template which you can edit in BO.
This is more or less the only way I know to edit the existing templates, because you can't do conditional statements inside email templates.
To add chosen address to order page in BO, you should use another hook - hookDisplayAdminOrder.
here you can add your own block to be display in order summary.
To find out which hooks are available, go to Hook.php and look for method exec(). Add this line error_log($hook_name).
When you perform a specific action, executed hooks will be logged and you will see what kind of hook you need.

In prestashop at which file cash on delivery module is calling

I need to know the location of file from where cash on delivery module is calling inside the choose your payment method checkout page.
You can find the template display on payment choices page of the module "cash on delivery" here : /modules/cashondelivery/views/templates/hook/payment.tpl
If you user older version of PrestaShop, this template is here : /modules/cashondelivery/payment.tpl
NB: If you want to modify this template for your theme is better to overwrite it by put it directly in the "modules" folder of your theme.

How do I connect my appixia app to my prestashop contact page?

I've added a contact button on the title bar but I can't get my contact form to display. Has anyone done this?
First of all, the contact button Module field should point to a new Activity module like VerticalContainerActivity which should contain an HtmlView module in its body. This HtmlView displays your contact page - put the address in its ContentUrl. Most of these steps are identical to what you'll find in this tutorial.
You can see an example of this in the diamonds sample app. Create a new app from the diamond store starting point and see how the contact button is implemented there.
The second important point to remember is that you shouldn't use regular store URLs in your Appixia app. When the user sees them, they would see your Prestashop theme with all the navigation and this will be very confusing inside a mobile app. Instead, make a mobile friendly version of your contact page which doesn't use your Prestashop theme and only shows the contact info content.
Using the Prestashop Contact Form in your Appixia app:
I'm not sure this is a 100% good idea in terms of usability. I don't recommend using a web form for contact in a mobile app.
A mobile phone is a communication device. It is has special integration for making phone calls and sending emails - I really recommend you use these methods instead. Look at the HTML source of this example to see how simple it is to integrate (it's just a link in your HTML).
In order to encourage your users to contact, you need to ask them for as little info as possible. Your website contact form makes your users type in their email address. If they email you directly through their device (with a mailto: link), their correct email will be filled automatically. Same with making a call, when they tap on the link, the number will be dialed automatically for them.
If you really insist on implementing the Prestashop contact form, this will require some Prestashop php games. You should find the contact form controller in the Prestashop source and create the same form (in php or hardcoded HTML) without your website theme. It will be a little annoying because after we submit the form, we also need to make sure the confirmation message is also displayed without your website theme.

Show custom text at "My personal information" page through plugin

I want to show some custom text at "My personal information" page in customer's account using a plugin in Prestashop. I have no idea how to do this?
Any help is much appreciated!
It is not possible to do it by a plugin or module, because prestashop is not providing any HOOK for that page / place.
But you can do it by a little work out there. I am considering you are using prestashop 1.5 , so lets work with that.
1) First create a cms page at admin and note its id. Lets consider its id is 10.
2) Now open the file override/controllers/front/IdentityController.php . In this class file create a function like below.
public function initContent()
{
parent::initContent();
$identityCmsPage = new CMS(10, $this->context->language->id_lang);
$this->context->smarty->assign('identityCmsPage', $identityCmsPage);
}
Now after that, open file at your themes folder themes/your theme/indentity.tpl
and display that cms page contents like
{$identityCmsPage->content}
and you will have that cms page contents there.
Note: This code is not tested and may have errors. Please adjust accordingly if you got any.