Installation
Download the pixel_googlemybusiness.zip file from the last release assets.
Admin
Go to the admin module catalog section and click Upload a module. Select the downloaded zip file.
Manually
Move the downloaded file in the Prestashop modules directory and unzip the archive. Go to the admin module catalog section and search for "Google My Business".
Configuration
From the module manager, find the module and click on configure.
- Google API Key : The Google Places API key is required
D5MyLvpGOTI2GYXpisyJQCKw9ED3wdk7
- Google Place IDs : Google place ids to import, one id per line. Required
ChIJLU7jZClu5kcR4PcOOO6p3I0
Import
At the command prompt, go to the Prestashop root directory and execute the following command:
./bin/console google_my_business:import_place {language}
language: ISO 639-1 (en, de, fr...)
Reviews
It is only possible to retrieve the last 5 reviews. Import often to accumulate the reviews.
Display
In any template, add the following Widget:
{widget name='pixel_googlemybusiness' display='name,rating,opening-hours,reviews'}
Display excepted options:
name: Place name (Eiffel tower)
rating: Average Rating (4/5)
opening-hours: Opening hours (Monday: 12:00 – 19:00, Tuesday: 10:00 – 19:00...)
review: the last reviews
For example, to display only reviews:
{widget name='pixel_googlemybusiness' display='reviews'}
Review filters:
review_number: the number of review to display
reviewminrating: only show reviews with rating greater or equal than this value
{widget name='pixel_googlemybusiness' display='reviews' review_number=5 review_min_rating=3}
Place filter:
Filter by place id with the place_ids
widget param (comma separated):
{widget name='pixel_googlemybusiness' place_ids='ChIJLU7jZClu5kcR4PcOOO6p3I0' display='name,rating,opening-hours,reviews'}
Note: Only places imported in the current context language will be displayed
Custom template
You can create your own template to display places.
Create a new template file in the pixel_googlemybusiness directory for your theme:
themes/{themeName}/modules/pixel_googlemybusiness/custom.tpl
{foreach from=$places item=place}
{$place->getPlaceId()}
{$place->getName()}
{$place->getRating()}
{$place->getUserRatingsTotal()}
{foreach from=$place->getOpeningHoursWeekdayText()|json_decode:1 item=hour}
{$hour}
{/foreach}
{foreach from=$place->getReviews() item=review}
{$review->getAuthorName()}
{$review->getTime()|date_format:"%e %B %Y"}
{$review->getRating()}
{if $review->getComment()}
{$review->getComment()}
{/if}
{/foreach}
{/foreach}
Add the template option in the widget with the template path:
{widget name='pixel_googlemybusiness' template='module:pixel_googlemybusiness/custom.tpl'}
Translations
In admin, go to the Translations page under the International menu.
Views directory protection
Changelog
1.0.4
Microdata added to template (@cdigruttola)
Phone and price level added to place (@cdigruttola)
Author URL added to review (@cdigruttola)
1.0.3
Custom widget template
1.0.2
Folders protection
1.0.1
Fix cache identifier for multiple widgets
1.0.0
First stable release