How to enable module in another module in Prestashop 1.7? - prestashop

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

Related

Shopify Liquid: Adding Sections to the Login Template

I have a client request to add manageable content to the login page. I assume this would work like managing any other page, simply create a section with the necessary schema and markup, then include that section ({% section 'section_name' %}) in the customers/login.liquid theme template. Problem is I don't see an option to select the login page in the page selection drop-down when customizing the theme. How do I allow my client to customize the login page via sections?
Thanks!
The actual login template cannot have manageable sections.
The closest workaround is to create a custom page template that includes a login form. The page can include manageable sections that are accessible when customizing the theme. The only issue is that all the automatically generated login url links will not go to this page, so any instances of those links need to be adjusted in the theme.
You can manually tell the customizer where to go by adding a hash(#) at the end of the url, followed by the shopify site path you want to visit/edit.
https://<domain>.myshopify.com/admin/themes/<theme-id>/editor#/account/login
Once you enter this in the browser url bar, you'll need to hit enter twice to get the page to reload properly.
If you do this and find it keeps sending you back to the homepage, it means that accounts are disabled on the Shopify store. You can change this by going to:
Shopify Admin > Settings > Checkout > Customer accounts
Then selecting either: Accounts are optional // Account are required

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

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

Broadleaf commerce display some product to logged in users only

I am developing an e-commerce application using broad-leaf commerce.
My requirement is I have to add an product from login panel and display that product to only logged in users. Here few product products will be visible to all users (guest too) and few will be visible to only logged in users.
is there any way to do this?
Thanx soulfly1983 fou your try,but I found another alternative to do this without any customization. here is the full procedure..
Add a new category from admin panel.
Add a new page from admin panel (under content tab) and note the URL should be the same of category and page.
3 In the page click on rule tab.
4 Check the yes button in "Restrict to certain customers?"
Click +rule button and the select "match all" and select customer registered is equal to false
So this page will be visible to only guest users.
In the HTML body section of the rule (in general tab) write a message "you need to log in to view this stuff"
When user will log in successfully the user will not be able to the page , because we applied a rule that only logged out users can see the page so this time user will see the category and products added to that category.
am I doing right? any regarding this suggestion?
You can either extend the Product entity and add a field that will indicate whether that product will be visible to all users, or alternatively you could simply add an attribute for each product via the admin interface. Either way you will need to modify the UI logic so that it will take this additional field (or attribute) into consideration.

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.

Any good Testimonial module / component in Joomla 1.6?

I am new to Joomla 1.6. I have a problem while trying to install "Freestyle Testimonials" (File Name - "freestyle_testimonials_lite-1.6.0(1).zip"), a component for testimonials for Joomla 1.6, as there is an error message appearing "Component Install: Another component is already using directory: /home/faster/public_html/webmaster/components/com_fst". I cannot install the component.
Then I tried installing another module for testimonial "AutarTimonial" (File Name - "mod_autartimonial1.6.zip"). It installed and can be viewed under module manager but I cannot put it into my desired location (such as Testimonials menu), in the Admin area.
I am totally confused and asking for help.
Thanks in advance.
Subhagreen
First, in order to fix the issue with Freestyle Testimonials you will need to delete the com_fst folder on your server. It sounds like the first install failed, but managed to make the folder which caused the second install attempt to fail.
Next, AutarTimonial is a module, not a component. Modules are designed to be placed in positions other than the main content area so there will not be a menu item for a module. AutarTimonial does have a component that probably goes with the module, you should install that, it should have the menu item you need.
You can also check out these other options: http://extensions.joomla.org/extensions/advanced-search-results/307991
Descriptions:
The JE Testimonial joomla component is one more useful utility for your Joomla-powered site that will provide you with a tool for managing and administering testimonials. JE Testimonial is the long waited component for the Joomla users from our extended brain search. It gives the in depth flexibility for using testimonials in Joomla based website.
Download link: http://www.jextn.com/joomla-testimonial-component
Demo link: http://www.jetestimonial.jextn.com/
JE Testimonial - 2.0.0(1.6 Native) Released with default ACL Features.
Features of JE Testimonial – 1.2
Module Features :
* The admin can limit text length in module.
* Read more link. The admin can enable/disable this “read more” link.
* Ordering of Testimonial Display. a. Ascending & Descending based on Ordering b. Order by ID both ascending & descending. c. Order By name both ascending & descending
Component Features :
* JE Testimonial - 1.2 have three more display order settings. The admin can change these settings from the component back end.
o The most recent first or the most recent last testimonial using ordering.
o Order by ID both ascending & descending.
o Order By name both ascending & descending.
Front end Feature List:
* Users can view the different type of template design depending upon the selections from the back end.
* Supports avatars/photos.
* Supports to add unlimited testimonial from the back end and front end.
* Visitors can add testimonial in the front-end with a simple form. Also admin can manage these details from the back-end.
* Show the authors name, url, location. But all are depending upon the settings from the back end.
* Front end testimonial form has captcha prevent spam.
* Admin can receive email notifications, when testimonials are added by the users in the front end.
* Display testimonials in the component and one of the associated modules.
Back end Features :
* Admin can Add/View/publish/edit/delete testimonials from the jetestimonial administrator panel.
* Jetestimonial component supports to translate all the major languages through the joomfish component.
* Choose whether to auto-publish new testimonial submissions.
* Choose whether the testimonials will be added by registered users.
* Choose the different themes from the backend and also can see the theme preview.
* Choose to display Number of testimonials per page.
* Choose whether you want captcha in the front end testimonal form.
* Manage the size of the avatar image.
New Features in JE Testimonial 1.1 :
* Removed the add ons in the front end editor and made it look better.
* The page title(form header) is now user friendly, so he can change to the name he likes.
* Implemented the parameters in the "Global Settings" for the User Form settings, to hide/show the city, country, email, company name and website fields.
* Implemented the support to sh404 component for user friendly url.
* Implemented a new plugin(content replacer plugin) for testimonial to display in the articles. You can replace the testimonials in the content area using {testimonial}
* Implemented the parameter in the "Global settings" for shadowbox effect, whether the external site links are opened in the shadow box or not.
JE Testimonials Module Features :
* JE Testimonial module has 4 slide effects with only one simple design.
* Settings for adjusting the modules with 4 slide effects.
* Admin can manage the specifications of this module.