Jump to content

Alejandro

Administrators
  • Content count

    32813
  • Joined

  • Last visited

  • Days Won

    342

Alejandro last won the day on May 22

Alejandro had the most liked content!

About Alejandro

  • Rank
    Advanced Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Alejandro

    Import as Unpublished

    Only if you modify the code to set the default state to zero. /components/com_jreviews_addons/import/cms_compat/joomla/models/import_listing.php $listingData['Listing'][self::_LISTING_PUBLISHED] = 1;
  2. Alejandro

    Invalid file request Error, I can't update

    Hi. Back in May I announced the transition to a new support system and I also sent a couple of emails to users related to this. You can find it here https://forum.jreviews.com/support/ With regards to the upgrade, you can't go directly to 2.7 from 2.6 via remote updates. You need to follow the upgrade instructions, and I recommend going to JReviews 3 directly, since JReviews 2.7 will reach its end of life in September. You can find upgrade instructions here https://docs.jreviews.com/?title=Upgrading_to_JReviews_3
  3. Alejandro

    Custom Field choosing multiple posts

    That's a warning that can be ignored. Remember I told you that this is a "hacky" way of doing it and that hasn't changed. JReviews is trying to create the missing file on that line, so I am not sure why it's complaining that it's not there if it's trying to create it. The file it's also not needed for what you are trying to do, but it's part of the logic that runs whenever a controller action is invoked.
  4. Alejandro

    Custom Field choosing multiple posts

    To update, you include the 'id' key (it's lowercase because it's normalized for Joomla and WordPress). For new listings, to insert as a user, you need to "load the user" first and JReviews will automatically pick it up in the controller. I already gave you the code for that above so you need to uncomment it and pass the right user ID. // If running the script via cron without a specific Joomla user you will want to // set the listing owner by uncommenting the two lines below // to load it using the user ID // $auth = S2Object::make('auth'); // $auth->loadUser(46);
  5. 1. The import add-ons is for listings only, not reviews, nor JReviews configuration nor setup of any kind. It also doesn't allow you to export/import media. 2. Yes you need to setup the site first as you said. However, the RapidLauncher Add-on, which is free, allows you to export/import most of the setup (categories, directories, listing types, field groups and fields), but not field options. For field options, if you export listings using the Import Add-on and import them on the other site, then they should be automatically created. 3. You can use the RapidLauncher Add-on. The Import Add-on is for listings only. 4. Sure, only those you include in the CSV file. 5. You can install the add-on in sites where you have the JReviews license for which you purchased it. If you need a dev domain added you can request that via suppor ticket. 6. Export and import time varies depending on the number of listings you have and I could be from seconds to minutes to more minutes. I hope that answers your questions.
  6. Alejandro

    API and zapier

    Sure, so here's how you can use Zapier to automatically import a feed as listings on your website. Again it's meant as a starting point that you can continue to develop to meet your own requirements. 1. The first step is to create the endpoint (webhook) URL on your site that will receive the POST request from Zapier with the feed data and create the listing. For this we simply use a new controller which we can place in overrides: Joomla: /templates/jreviews_overrides/controllers/zapier_listing_feed_controller.php WordPress: /jreviews_overrides/controllers/zapier_listing_feed_controller.php <?php defined( 'MVC_FRAMEWORK') or die( 'Direct Access to this location is not allowed.' ); class ZapierListingFeedController extends MyController { /** * This value must match the value you entered in Zapier in order to pass authentication validation * @var string */ protected $zapierToken = '0123456789'; public function index() { $post = $this->data; // Simple authentication to prevent direct access to the webhook without knowledge of the "token" value // that is included with the Zapier request if (!isset($post[$this->zapierToken])) { return $this->response->html()->access_denied(); } // Use filters to allow listing creation, editor use and automatic publishing regardless of the site access settings Clickfwd\Hook\Filter::add('can_create_listing', [$this,'can_create_listing'], 1); Clickfwd\Hook\Filter::add('can_use_editor_in_listing', [$this,'can_create_listing'], 1); Clickfwd\Hook\Filter::add('trusted_on_create_listing', [$this,'can_create_listing'], 1); // // Set the form token $_POST[cmsFramework::getToken()] = 1; // // Build the listing data $params = []; // You can either hard-code the category ID below or pass it with your Zapier data and read it from the $post array. That would allow you to // to have multiple zaps from different feeds and dynamically insert the listings into different categories $categoryId = 23; // Ensure that the form passes the consent checkbox validation if it's enabled $params['data']['consent'] = true; $params['data']['name'] = $post['author']; $params['data']['created_by_alias'] = $post['author']; // Add the standard fields // Catid is required and must be a JReviews category, title is required if not disabled $params['data']['Listing'] = [ 'catid' => $categoryId, 'title' => $post['title'], 'introtext' => $post['__raw']['summary'], 'fulltext' => '', ]; // The raw data below is mainly required to be able to include HTML in the summary and description $params['data']['__raw']['Listing'] = [ 'introtext' => $post['__raw']['summary'], 'fulltext' => '', ]; // // Add the custom field data // // For select,radio,checkbox fields, use the field option values // // Checkbox and multiselect fields need to use array inputs // // $params['data']['Field']['Listing'] = [ // // 'jr_website' => 'http://origamiappbuilder.com', // // 'jr_checkbox' => ['one','two'] // // ]; $output = $this->requestAction('listings/_save',$params); $output = json_decode($output,true); if ($output['success'] == true) { // Listing was successfully created $listingId = $output['listing_id']; return $this->response->html()->success('Listing was successfully created'); } else { return $this->response->html()->fail('Failed to create listing'); } } /* * Override listing create permission */ public function can_create_listing($permission,$params) { return true; } /* * Override listing Wysywig editor permission */ public function can_use_editor_in_listing($permission,$params) { return true; } /* * Override listing moderation */ public function trusted_on_create_listing($trust,$params) { return true; } } 2. Clear the file registry in JReviews 3. Now you can create your zap in Zapier. I used the "New Item in Feed" for the Trigger and "Post" for the action. Below you can see the settings I used for the "Post" template. There I add the webhook URL to the controller and the variables that are sent via post, inclusing a made-up authentication value which prevents others to access this endpoint to insert data on your site. So change that value and make it difficult to guess! That's it. If you use "Test this step" you should see the listing get created on your site. Of course you need to do your own matching for the title, author, summary, etc. fields and you can hardcode custom field values if you want. If your feed as extra info then you can match that as well. I think this is a great starting point that is quite easy to do with the latest dev features in JReviews 3 so you can extend the functionality of your site without making any core changes. Let me know how it goes.
  7. Alejandro

    API and zapier

    I also have another example now with an incoming Zapier request to insert new items from a feed as listings in JReviews. Is that something that interests you?
  8. Alejandro

    API and zapier

    I am going to give you some code to help you get started with creating your own Zapier integrations taking advantage of the developer events and without having to modify any core files. This is only for outgoing requests to Zapier. 1. First you need to create a new zapier listener provider in overrides: Joomla: /templates/jreviews_overrides/events/providers/zapier_listener_provider.php WordPress: /jreviews_overrides/events/providers/zapier_listener_provider.php I use the update event for testing, but it's commented below because I only want the zap to execute on new listings <?php defined( 'MVC_FRAMEWORK') or die; use Clickfwd\Listener\ListenerProvider; class ZapierListenerProvider extends ListenerProvider { protected $listen = [ 'JReviews\Events\ListingWasFirstPublished' => [ 'JReviews\Listeners\SendNewListingToZapier', ], 'JReviews\Events\ListingWasUpdated' => [ // 'JReviews\Listeners\SendNewListingToZapier', ], ]; } 2. Then you create the SendNewListingToZapier listener that will execute when the ListingWasFirstPublished event is triggered. Joomla: /templates/jreviews_overrides/events/listeners/send_new_listing_to_zapier.php WordPress: /jreviews_overrides/events/listeners/send_new_listing_to_zapier.php The code below is just for illustration purposes to help you get started with your own zaps. The listener makes a request to the Zapier hook URL for your zap and it sends the data in the $payload array. You have control over this $payload array so you can add whatever you want there. In this example I am going a bit further and doing some pre-processing for the main photo and gallery photos because I created a PDF zap and I passing the HTML directly to it. <?php namespace JReviews\Listeners; defined( 'MVC_FRAMEWORK') or die; use JReviews\Listeners\Traits\ListenerSetting; use Clickfwd\Listener\QueueableListener; use League\Event\EventInterface; use GuzzleHttp\Client as Guzzle; \S2App::import('ListenerTrait','listener_setting','jreviews'); class SendNewListingToZapier extends QueueableListener { use ListenerSetting; protected $queue = false; /** * Execution delay in seconds * @var int */ protected $queue_delay = 5*60; // Update the URL with the hook URL provided to you by Zapier protected $url = 'https://hooks.zapier.com/hooks/catch/1111111/aaaaaa/'; public function handle(EventInterface $event) { $listing = $event->getListing(); if ( $listing ) { $client = new Guzzle(); $payload = [ 'title' => $listing['Listing']['title'], 'summary' => $listing['Listing']['summary'], 'description' => $listing['Listing']['description'], 'category' => $listing['Category']['title'], 'directory' => $listing['Directory']['title'], 'owner'=> $listing['User']['username'], ]; $photos = []; $fields = []; foreach ( $listing['Field']['pairs'] AS $fname => $field) { $fields[$fname] = implode(',', $field['text']); } foreach ( \S2Array::get($listing,'Media.photo') AS $photo ) { $photos[] = '<img src="'.$photo['media_info']['image']['url'].'" />'; } $payload['main_photo'] = sprintf('<img src="%s" />', \S2Array::get($listing,'MainMedia.media_info.image.url')); $payload['photos'] = implode("\n",$photos); $payload['fields'] = $fields; $response = $client->post($this->url, [ \GuzzleHttp\RequestOptions::JSON => $payload ]); } } } 3. Clear the file registry in JReviews so it can recognize the new files. 4. Create your zap. I am using the "Catch Hook" trigger and the "Submit Print Job" action to create a PDF on Google Drive. Once you add the "Catch Hook" trigger, grab the hook URL and replace it in the listener file above. Submit a listing for testing, and then you will be able to see the $payload array keys as options to add to your PDF template as shown below: Events are executed synchronously so they will cause a delay in listing submission request response by making an external API call to Zapier. What this means is that the user will have to wait a bit longer after submitting the listing to see the success message. If you want to avoid this you can take advantage of the Queue Add-on and in the listener file above change the value of $queue from false to true. Another advantage of using the Queue Add-on to process these jobs is that you can add delays to the execution to, for example, allow the user to finish uploading media to the listing so it's included in the $payload.
  9. Alejandro

    Custom Field choosing multiple posts

    Here's something you can try to programmatically create listings from other extensions/plugins: <?php // Load the JReviews framework require_once JPATH_BASE.'/components/com_jreviews/jreviews/framework.php'; // Set the form token $_POST[cmsFramework::getToken()] = 1; // Let the framework know the code is accessed directly so it suppresses output headers $_REQUEST['requested'] = 1; // Build the request data $params = []; // Routing data $params['data']['controller'] = 'listings'; $params['data']['action'] = '_save'; // Ensure that the form passes the consent checkbox validation if it's enabled $params['data']['consent'] = true; // Add the standard fields // Catid is required and must be a JReviews category, title is required if not disabled $params['data']['Listing'] = [ 'catid' => 23, 'title' => 'Programatically submitted listing', 'introtext' => '<p>This is the listing summary.</p>', 'fulltext' => '<p>This is the listing description.</p>', ]; // Add the custom field data // For select,radio,checkbox fields, use the field option values // Checkbox and multiselect fields need to use array inputs $params['data']['Field']['Listing'] = [ 'jr_website' => 'http://origamiappbuilder.com', 'jr_checkbox' => ['one','two'] ]; $Dispatcher = new S2Dispatcher('jreviews'); // If running the script via cron without a specific Joomla user you will want to // set the listing owner by uncommenting the two lines below // to load it using the user ID // $auth = S2Object::make('auth'); // $auth->loadUser(46); $output = $Dispatcher->dispatch($params); $output = json_decode($output,true); if ($output['success'] == true) { // Listing was successfully created $listingId = $output['listing_id']; }
  10. Alejandro

    GeoMaps with ony GPS

    Hello. Yes, it would work. The proximity search converts the typed address into coordinates and then performs the search using those coordinates.
  11. Alejandro

    Map cover image

    Does the photo selected as cover appear as published or unpublished when it's hidden once the premium order expires? I tried to replicate this by unpublishing the cover photo which is what paid listings should be doing and I see the map appear in it's place. Can you create a ticket with Site Credentials added so I can look into it?
  12. Alejandro

    Public Profile Already Exists!

    Try disabling the session cache in JReviews.
  13. Starting sometime in July Google started rolling out it's new pricing model for all Google Maps API related services. Learn more. This means that unless you create a billing account and associate it with your Google Cloud Console project, maps, and all other GeoMaps related features that depend on Google API services (geolocation, directions, and streetview) will stop working. Google is giving you a $200 credit per month. After that they will charge incrementally based on their new pricing structure. You can also set a maximum daily spend limit. What do you need to do? Go to the Google Cloud Console Billing page and create a new billing account for your project if you don't already have one. Go to the Google Cloud Console Dashboard and select the project you use with your JReviews site from the top bar. Make sure this project has all the necessary APIs enabled for GeoMaps Once inside your project, click the hamburger menu icon on the top-left and select Billing to associate your project with the billing account you created in step 1. Check your email to find a verification/confirmation email from Google to finalize the process. You may need to wait a few minutes for the changes to go live.
  14. A few users have reported the error below when editing listings after recent upgrades of both Joomla and JReviews. Call to undefined method JEventDispatcher::getContent The issue is not caused by JReviews, because it's also present when editing regular Joomla articles. So far I've narrowed it down to the Joomla editor "readmore button" plugin and disabling it allows the editor to work correctly. I haven't experienced this issue on my own sites where the "readmore" button appears and works correctly inside the editor so I am not sure what's causing this problem on the affected sites.
×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Please refer to our Privacy Policy.