idxbroker / wordpress-plugin

IMPress for IDX Broker
http://www.idxbroker.com
GNU General Public License v2.0
22 stars 30 forks source link

IMPB-1494 Similar IMPress carousel widget shows duplicate listing when there are not enough listings. #464

Open lainvineyard opened 2 years ago

lainvineyard commented 2 years ago

Pull Requests

🐛 Are you fixing a bug? Yes

Description of the Change

currently the plugin relies on the display attribute and a selection via class based on the display attribute to determine what element should be setup with owlCarousel.

because the display attribute is not guaranteed to be unique, there are some situations where having multiple carousels on the same page can cause unexpected behavior and duplicated listings to be shown.

this PR changes the html output for the carousel widget and shortcode to instead use a unique id generated with uniqid() to avoid the unexpected behavior.

Verification Process

  1. setup an IDX Broker account so that you can pull in 1 featured listing via shortcode (like with an agentid set) and multiple supplemental listings via shortcode (by creating several supplemental listings).

  2. create a page within a WordPress site with IMPress 3.0.10 that has two carousel widgets or shortcodes with the display attribute for each set to the same number (like 3), with the supplemental shortcode first followed by the featured shortcode (so that the widget with only a single listing appears after the widget with more listings)

  3. publish the page and note that the second widget has its single listing duplicated. (see screenshot for example on live test site)

image

  1. re-arrange the widgets so that they're in the opposite order. publish and note the different behavior (see screenshot, where the widgets are both set to display 3 but only a single listing is shown at a time for both)

image

  1. install version of plugin with fixes in PR applied. note that the behavior has been resolved and each widget is displaying listings as expected without duplication or limitation. (see screenshot)

image

Release Notes

Fix: corrected display of listings in carousel widgets when multiple carousel widgets on a single page shared the same display attribute

Review

Pull Requests must have the sign-off of two other developers and at least one of these must be an IDX Broker team member.