Plugin Directory

Changeset 3737527


Ignore:
Timestamp:
10/10/2026 02:29:49 AM (2 weeks ago)
Author:
homlity
Message:

Se arregla bug del card del inmueble

Location:
homlity-real-estate/trunk
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • homlity-real-estate/trunk/assets/js/pricing-admin.js

    r3623792 r3737527  
    77    function matchBlocks(slug, baseId) {
    88        const wantsPermuta = baseId === 4 || slug.includes('permuta') || slug.includes('swap');
    9         const wantsRent = baseId === 1 || baseId === 3 || slug.includes('arriendo') || slug.includes('rent');
     9        const wantsRent = baseId === 1 || baseId === 3 || slug.includes('arriendo') || slug.includes('alquil') || slug.includes('rent');
    1010        const wantsSale = baseId === 2 || baseId === 3 || slug.includes('venta') || slug.includes('sale');
    1111        const wantsAdmin = wantsRent || wantsSale || slug.includes('admin') || slug.includes('adm');
  • homlity-real-estate/trunk/includes/schema/class-homlity-property-schema.php

    r3630479 r3737527  
    2626        }
    2727
     28        $offers = $this->offer_nodes($post_id, $url);
    2829        $nodes = array_filter([
    29             $this->listing_node($post_id, $url),
     30            $this->listing_node($post_id, $url, $offers),
    3031            $this->property_node($post_id, $url),
    31             $this->offer_node($post_id, $url),
     32            ...$offers,
    3233            $this->agent_node(),
    3334            $this->breadcrumb_node($post_id, $url),
    … …  
    3940    // ── RealEstateListing ─────────────────────────────────────────────────────
    4041
    41     private function listing_node(int $post_id, string $url): array
     42    private function listing_node(int $post_id, string $url, array $offers): array
    4243    {
    4344        $images = Homlity_Schema_Helpers::images($post_id);
    … …  
    5556            'identifier'   => $code !== '' ? $code : null,
    5657            'mainEntity'   => ['@id' => $url . '#property'],
    57             'offers'       => ['@id' => $url . '#offer'],
     58            'offers'       => count($offers) === 1
     59                ? ['@id' => $offers[0]['@id']]
     60                : (array_map(static fn(array $offer): array => ['@id' => $offer['@id']], $offers) ?: null),
    5861        ];
    5962
    … …  
    112115    // ── Offer ─────────────────────────────────────────────────────────────────
    113116
    114     private function offer_node(int $post_id, string $url): array
    115     {
    116         $op          = Homlity_Schema_Helpers::operation($post_id);
    117         $price       = Homlity_Schema_Helpers::price($post_id);
    118         $currency    = Homlity_Schema_Helpers::currency($post_id);
     117    private function offer_nodes(int $post_id, string $url): array
     118    {
     119        if (Homlity_Schema_Helpers::operation($post_id) !== 'both') {
     120            return [$this->offer_node($post_id, $url)];
     121        }
     122        $offers = [];
     123        foreach (['rent', 'sale'] as $type) {
     124            // An absent second price must not reuse the other operation's price.
     125            if ((float) Homlity_Schema_Helpers::get_meta($post_id, 'price_' . $type) > 0) {
     126                $offers[] = $this->offer_node($post_id, $url, $type);
     127            }
     128        }
     129        return $offers;
     130    }
     131
     132    private function offer_node(int $post_id, string $url, string $type = ''): array
     133    {
     134        $op          = $type !== '' ? $type : Homlity_Schema_Helpers::operation($post_id);
     135        $price       = $type !== '' ? Homlity_Schema_Helpers::get_meta($post_id, 'price_' . $type) : Homlity_Schema_Helpers::price($post_id);
     136        $currency    = $type !== ''
     137            ? (Homlity_Schema_Helpers::get_meta($post_id, 'currency_' . $type) ?: (new \Homlity\PluginInmobiliario\Services\CurrencyService())->baseCurrency())
     138            : Homlity_Schema_Helpers::currency($post_id);
    119139        $valid_until = Homlity_Schema_Helpers::price_valid_until($post_id);
    120140        $agent_id    = home_url('/') . '#realestateagent';
    … …  
    122142        $node = [
    123143            '@type'            => 'Offer',
    124             '@id'              => $url . '#offer',
     144            '@id'              => $url . '#offer' . ($type !== '' ? '-' . $type : ''),
    125145            'url'              => $url,
    126146            'price'            => $price !== '' ? $price : null,
  • homlity-real-estate/trunk/includes/schema/class-homlity-schema-helpers.php

    r3685581 r3737527  
    154154        $is_sale = preg_match('/\b(venta|sale|sell|compra|compraventa)\b/', $haystack) === 1;
    155155        $is_rent = preg_match('/\b(arriendo|alquiler|rent|lease|arrendamiento)\b/', $haystack) === 1;
     156        foreach ($terms as $term) {
     157            if ($term instanceof \WP_Term && $term->taxonomy === \Homlity\PluginInmobiliario\Services\PropertyTaxonomies::TAXONOMY_OPERATION) {
     158                $families = \Homlity\PluginInmobiliario\Services\PropertyTaxonomies::operationFamiliesForTerm($term);
     159                $is_sale = $is_sale || in_array('sale', $families, true);
     160                $is_rent = $is_rent || in_array('rent', $families, true);
     161            }
     162        }
    156163
    157164        if ($is_sale && $is_rent) {
  • homlity-real-estate/trunk/plugin-inmobiliario.php

    r3729219 r3737527  
    44 * Plugin Name: Homlity Real Estate
    55 * Description: Homlity Real Estate, gestor de inmuebles, asesores, SEO y GEO listo para WordPress.
    6  * Version:     2.9.13
     6 * Version:     2.9.14
    77 * Author:      Ecosistema Inmobiliario Homlity
    88 * Author URI:  https://homlity.com/
    … …  
    3131if (!defined('HOMLITY_PLUGIN_PATH'))             define('HOMLITY_PLUGIN_PATH', plugin_dir_path(__FILE__));
    3232if (!defined('HOMLITY_PLUGIN_URL'))              define('HOMLITY_PLUGIN_URL', plugin_dir_url(__FILE__));
    33 if (!defined('HOMLITY_PLUGIN_VERSION'))          define('HOMLITY_PLUGIN_VERSION', '2.9.13');
     33if (!defined('HOMLITY_PLUGIN_VERSION'))          define('HOMLITY_PLUGIN_VERSION', '2.9.14');
    3434if (!defined('HOMLITY_PLUGIN_SLUG'))             define('HOMLITY_PLUGIN_SLUG', 'homlity-real-estate');
    3535if (!defined('HOMLITY_PLUGIN_TEXT_DOMAIN'))      define('HOMLITY_PLUGIN_TEXT_DOMAIN', 'homlity-real-estate');
  • homlity-real-estate/trunk/readme.txt

    r3729219 r3737527  
    55Tested up to: 7.1
    66Requires PHP: 8.0
    7 Stable tag: 2.9.13
     7Stable tag: 2.9.14
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
  • homlity-real-estate/trunk/src/Services/CardPriceResolver.php

    r3729219 r3737527  
    3131            'homlity_plugin_card_price_lines',
    3232            null,
    33             self::resolve($raw, $baseOperationId, $opSlugAndName),
     33            self::resolve($raw, $baseOperationId, $opSlugAndName, self::operationLabelsForTerm($term instanceof \WP_Term ? $term : null)),
    3434            $postId
    3535        );
    3636    }
    3737
     38    /** @return array{rent:bool,sale:bool} */
     39    public static function operationTypes(int $baseOperationId, string $opSlugAndName): array
     40    {
     41        // Identity remains authoritative even when the display name changes.
     42        if ($baseOperationId > 0) {
     43            return ['rent' => in_array($baseOperationId, [1, 3], true), 'sale' => in_array($baseOperationId, [2, 3], true)];
     44        }
     45        $operation = mb_strtolower($opSlugAndName);
     46        return [
     47            'rent' => in_array($baseOperationId, [1, 3], true)
     48                || preg_match('/(?:^|[\s\/_-])(?:arriendo|arrendamiento|alquiler|renta|rent)(?:$|[\s\/_-])/u', $operation) === 1,
     49            'sale' => in_array($baseOperationId, [2, 3], true) || strpos($operation, 'venta') !== false,
     50        ];
     51    }
     52
     53    /**
     54     * Business identities choose the price; editable term names choose its label.
     55     * Mixed operations use the configured names of the individual operations.
     56     *
     57     * @return array{rent:string,sale:string}
     58     */
     59    public static function operationLabelsForTerm(?\WP_Term $term): array
     60    {
     61        $labels = [];
     62        $configured = [];
     63        foreach (['rent' => 1, 'sale' => 2] as $type => $baseId) {
     64            $baseTerm = PropertyTaxonomies::baseOperationTermById($baseId);
     65            if ($baseTerm instanceof \WP_Term) {
     66                $baseTerm = PropertyTaxonomies::canonicalOperationTerm($baseTerm);
     67            }
     68            $labels[$type] = $baseTerm instanceof \WP_Term && trim($baseTerm->name) !== ''
     69                ? $baseTerm->name
     70                : PropertyTaxonomies::baseOperations()[$baseId]['name'];
     71            $configured[$type] = $labels[$type] !== PropertyTaxonomies::baseOperations()[$baseId]['name'];
     72        }
     73
     74        if ($term instanceof \WP_Term && trim($term->name) !== '') {
     75            $types = self::operationTypes(PropertyTaxonomies::baseOperationIdForTerm($term), $term->slug . ' ' . $term->name);
     76            if ($types['rent'] !== $types['sale']) {
     77                $labels[$types['rent'] ? 'rent' : 'sale'] = $term->name;
     78            } elseif ($types['rent'] && $types['sale']) {
     79                foreach (preg_split('/\s*(?:\/|\by\b|&)\s*/iu', $term->name) ?: [] as $part) {
     80                    $partTypes = self::operationTypes(0, $part);
     81                    if ($partTypes['rent'] !== $partTypes['sale']) {
     82                        $type = $partTypes['rent'] ? 'rent' : 'sale';
     83                        if (!$configured[$type]) {
     84                            $labels[$type] = $part;
     85                        }
     86                    }
     87                }
     88            }
     89        }
     90
     91        return $labels;
     92    }
     93
    3894    /**
    3995     * @param array<string,mixed> $raw Values keyed by the logical meta names.
     96     * @param array<string,string> $labels Display names keyed by rent/sale.
    4097     * @return array<int,array{type:string,label:string,amount:string,admin:?string,admin_included:bool}>
    4198     */
    42     public static function resolve(array $raw, int $baseOperationId, string $opSlugAndName): array
     99    public static function resolve(array $raw, int $baseOperationId, string $opSlugAndName, array $labels = []): array
    43100    {
    44         $operation = mb_strtolower($opSlugAndName);
    45         $isSale = in_array($baseOperationId, [2, 3], true) || strpos($operation, 'venta') !== false;
    46         $isRent = in_array($baseOperationId, [1, 3], true) || strpos($operation, 'arriendo') !== false;
    47         $unknown = !$isSale && !$isRent;
     101        $types = self::operationTypes($baseOperationId, $opSlugAndName);
     102        $unknown = !$types['sale'] && !$types['rent'];
    48103        $currencyService = new CurrencyService();
    49104        $lines = [];
    50105
    51         foreach (['rent' => $isRent, 'sale' => $isSale] as $type => $enabled) {
     106        foreach ($types as $type => $enabled) {
    52107            $amount = $raw['price_' . $type] ?? '';
    53108            if ((!$enabled && !$unknown) || $amount === '' || (float) $amount <= 0) {
    … …  
    64119            $lines[] = [
    65120                'type' => $type,
    66                 'label' => $type === 'rent' ? __('Arriendo', 'homlity-real-estate') : __('Venta', 'homlity-real-estate'),
     121                'label' => $labels[$type] ?? ($type === 'rent' ? __('Arriendo', 'homlity-real-estate') : __('Venta', 'homlity-real-estate')),
    67122                'amount' => (string) homlity_plugin_apply_filters('homlity_plugin_format_price', null, $amount, $currency),
    68123                'admin' => $admin,
  • homlity-real-estate/trunk/src/Services/PropertyPostType.php

    r3665656 r3737527  
    22842284
    22852285        if ($column === 'property_operation_value') {
    2286             $operation = '';
    2287             $operationTerms = wp_get_post_terms($postId, PropertyTaxonomies::TAXONOMY_OPERATION);
    2288             if (!is_wp_error($operationTerms) && !empty($operationTerms)) {
    2289                 $operation = strtolower(sanitize_title($operationTerms[0]->name));
    2290             }
    2291 
    2292             $currencyService = new CurrencyService();
    2293             $currency = (string) get_post_meta($postId, '_property_currency_sale', true);
    2294             if ($currency === '') {
    2295                 $currency = (string) get_post_meta($postId, '_property_currency_rent', true);
    2296             }
    2297             if ($currency === '') {
    2298                 $currency = (string) $currencyService->baseCurrency();
    2299             }
    2300 
    2301             $priceSale = (string) get_post_meta($postId, '_property_price_sale', true);
    2302             $priceRent = (string) get_post_meta($postId, '_property_price_rent', true);
    2303             $priceAdmin = (string) get_post_meta($postId, '_property_price_admin', true);
    2304 
    2305             $value = '';
    2306             if (strpos($operation, 'arriendo') !== false || strpos($operation, 'rent') !== false) {
    2307                 $value = $priceRent !== '' ? $priceRent : $priceSale;
    2308             } else {
    2309                 $value = $priceSale !== '' ? $priceSale : $priceRent;
    2310             }
    2311 
    2312             if ($value === '' && $priceAdmin !== '') {
    2313                 $value = $priceAdmin;
    2314             }
    2315 
    2316             if ($value === '') {
     2286            $lines = CardPriceResolver::forPost($postId);
     2287            if ($lines === []) {
    23172288                echo '—';
    23182289                return;
    23192290            }
    2320 
    2321             $formatted = \homlity_plugin_apply_filters('homlity_plugin_format_price', null, $value, $currency);
    2322             echo esc_html((string) ($formatted !== null ? $formatted : $value));
     2291            foreach ($lines as $index => $line) {
     2292                if ($index > 0) {
     2293                    echo '<br>';
     2294                }
     2295                echo esc_html($line['label'] . ': ' . $line['amount']);
     2296            }
    23232297            return;
    23242298        }
  • homlity-real-estate/trunk/src/Services/PropertySearchService.php

    r3665656 r3737527  
    163163            );
    164164            if ($termIds) {
     165                if ($taxonomy === PropertyTaxonomies::TAXONOMY_OPERATION) {
     166                    $termIds = PropertyTaxonomies::expandOperationTermIds($termIds);
     167                }
    165168                $args['tax_query'][] = [
    166169                    'taxonomy' => $taxonomy,
    … …  
    185188                    'taxonomy' => $taxonomy,
    186189                    'field'    => 'term_id',
    187                     'terms'    => [$presetId],
     190                    'terms'    => $taxonomy === PropertyTaxonomies::TAXONOMY_OPERATION
     191                        ? PropertyTaxonomies::expandOperationTermIds([$presetId])
     192                        : [$presetId],
    188193                ];
    189194            }
    … …  
    866871                continue;
    867872            }
    868             $text = strtolower(remove_accents($term->slug . ' ' . $term->name));
    869             if (
    870                 strpos($text, 'arriendo') !== false || strpos($text, 'alquil') !== false
    871                 || strpos($text, 'renta') !== false  || strpos($text, 'rent') !== false
    872             ) {
     873            if (in_array('rent', PropertyTaxonomies::operationFamiliesForTerm($term), true)) {
    873874                return '_property_price_rent';
    874875            }
  • homlity-real-estate/trunk/src/Services/PropertyTaxonomies.php

    r3723270 r3737527  
    2323    private const OPERATION_BASE_KEY_META = '_homlity_base_operation_key';
    2424    private const OPERATION_BASE_ID_META = '_homlity_base_operation_id';
     25    private const OPERATION_ALIAS_SLUGS = [
     26        1 => ['alquiler', 'renta', 'arriendo', 'arrendamiento', 'rent'],
     27        2 => ['venta', 'sale'],
     28        3 => ['alquiler-venta', 'alquiler-y-venta', 'venta-alquiler', 'arriendo-venta', 'arriendo-y-venta', 'venta-arriendo', 'ambos'],
     29    ];
    2530    private const PROPERTY_TYPE_BASE_KEY_META = '_homlity_base_property_type_key';
    2631    private const PROPERTY_TYPE_BASE_ID_META = '_homlity_base_property_type_id';
    … …  
    11441149            'taxonomy' => self::TAXONOMY_OPERATION,
    11451150            'hide_empty' => false,
     1151            'fields' => 'all',
    11461152        ]);
    11471153        if (is_wp_error($allTerms) || empty($allTerms)) {
    … …  
    11511157        $expanded = $termIds;
    11521158        foreach ($selectedTerms as $selectedTerm) {
     1159            if (self::operationAliasBaseId($selectedTerm) === 0) {
     1160                continue;
     1161            }
    11531162            $selectedFamilies = self::operationFamiliesForTerm($selectedTerm);
    11541163            if (empty($selectedFamilies)) {
    … …  
    12131222     * @return string[]
    12141223     */
    1215     private static function operationFamiliesForTerm(\WP_Term $term): array
     1224    public static function operationFamiliesForTerm(\WP_Term $term): array
    12161225    {
    12171226        // Base terms are classified by identity so renaming them (e.g. "Venta"
    12181227        // to "Comprar") keeps "Venta" searches matching "Arriendo/Venta".
    12191228        $baseFamilies = [1 => ['rent'], 2 => ['sale'], 3 => ['rent', 'sale'], 4 => []];
    1220         $baseId = self::baseOperationIdForTerm($term);
     1229        $baseId = self::operationAliasBaseId($term);
    12211230        if (isset($baseFamilies[$baseId])) {
    12221231            return $baseFamilies[$baseId];
    … …  
    12241233
    12251234        return self::operationFamiliesFromText($term->slug . ' ' . $term->name);
     1235    }
     1236
     1237    /**
     1238     * Resolve only exact synonyms; specialized operations keep their own URLs.
     1239     * A renamed base term wins over historical aliases.
     1240     */
     1241    public static function canonicalOperationTerm(\WP_Term $term): \WP_Term
     1242    {
     1243        $definitions = self::baseOperations();
     1244        $baseId = self::operationAliasBaseId($term);
     1245        if (!isset(self::OPERATION_ALIAS_SLUGS[$baseId])) {
     1246            return $term;
     1247        }
     1248
     1249        $baseTerm = self::baseOperationTermById($baseId);
     1250        if ($baseTerm instanceof \WP_Term
     1251            && ($baseTerm->slug !== $definitions[$baseId]['slug'] || $baseTerm->name !== $definitions[$baseId]['name'])) {
     1252            return $baseTerm;
     1253        }
     1254        foreach (self::OPERATION_ALIAS_SLUGS[$baseId] as $slug) {
     1255            $candidate = get_term_by('slug', $slug, self::TAXONOMY_OPERATION);
     1256            if ($candidate instanceof \WP_Term
     1257                && self::operationFamiliesForTerm($candidate) === self::operationFamiliesForTerm($term)) {
     1258                return $candidate;
     1259            }
     1260        }
     1261
     1262        return $baseTerm ?? $term;
     1263    }
     1264
     1265    private static function operationAliasBaseId(\WP_Term $term): int
     1266    {
     1267        if ($term->taxonomy !== self::TAXONOMY_OPERATION) {
     1268            return 0;
     1269        }
     1270        $baseId = self::baseOperationIdForTerm($term);
     1271        if ($baseId === 0) {
     1272            foreach (self::OPERATION_ALIAS_SLUGS as $id => $slugs) {
     1273                if (in_array($term->slug, $slugs, true)) {
     1274                    $baseId = $id;
     1275                    break;
     1276                }
     1277            }
     1278        }
     1279        return $baseId;
     1280    }
     1281
     1282    public static function canonicalOperationSlug(string $slug): string
     1283    {
     1284        $term = get_term_by('slug', $slug, self::TAXONOMY_OPERATION);
     1285        return $term instanceof \WP_Term ? self::canonicalOperationTerm($term)->slug : $slug;
     1286    }
     1287
     1288    /** @param \WP_Term[] $terms @return \WP_Term[] */
     1289    public static function publicOperationTerms(array $terms): array
     1290    {
     1291        $canonical = [];
     1292        foreach ($terms as $term) {
     1293            if ($term instanceof \WP_Term) {
     1294                $representative = self::canonicalOperationTerm($term);
     1295                $canonical[$representative->term_id] = $representative;
     1296            }
     1297        }
     1298        return array_values($canonical);
    12261299    }
    12271300
  • homlity-real-estate/trunk/src/Services/SeoIntegrationService.php

    r3665656 r3737527  
    498498            // phpcs:enable WordPress.DB.PreparedSQL.InterpolatedNotPrepared,WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching
    499499            foreach ((array) $slugs as $slug) {
     500                if ($taxonomy === $taxOp) {
     501                    $slug = PropertyTaxonomies::canonicalOperationSlug((string) $slug);
     502                }
    500503                $urls[] = home_url('/inmuebles/' . $prefix . '/' . rawurlencode((string) $slug) . '/');
    501504            }
    … …  
    530533            // phpcs:enable WordPress.DB.PreparedSQL.InterpolatedNotPrepared,WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching
    531534            foreach ((array) $rows as $row) {
     535                if ($taxA === $taxOp) {
     536                    $row = clone $row;
     537                    $row->slug_a = PropertyTaxonomies::canonicalOperationSlug((string) $row->slug_a);
     538                }
    532539                $urls[] = home_url(
    533540                    '/inmuebles/' . $prefA . '/' . rawurlencode((string) $row->slug_a)
    … …  
    559566        // phpcs:enable WordPress.DB.PreparedSQL.InterpolatedNotPrepared,WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching
    560567        foreach ((array) $rows as $row) {
     568            $operationSlug = PropertyTaxonomies::canonicalOperationSlug((string) $row->g);
    561569            $urls[] = home_url(
    562                 '/inmuebles/gestion/' . rawurlencode((string) $row->g)
     570                '/inmuebles/gestion/' . rawurlencode($operationSlug)
    563571                . '/tipo/' . rawurlencode((string) $row->t)
    564572                . '/ciudad/' . rawurlencode((string) $row->c) . '/'
  • homlity-real-estate/trunk/src/Services/TemplateService.php

    r3665656 r3737527  
    2626        add_action('pre_get_posts', [$this, 'filterArchiveQuery']);
    2727        add_action('template_redirect', [$this, 'redirectLegacyFilteredArchiveUrl'], 1);
     28        add_action('template_redirect', [$this, 'redirectOperationAliasArchiveUrl'], 1);
    2829        add_action('template_redirect', [$this, 'maybeRenderTechnicalSheetPdf'], 1);
    2930        add_action('template_redirect', [$this, 'redirectLegacyEnglishUrls']);
    … …  
    301302                continue;
    302303            }
     304            if ($routeKey === 'gestion') {
     305                $value = PropertyTaxonomies::canonicalOperationSlug($value);
     306            }
    303307            $segments[] = $routeKey;
    304308            $segments[] = rawurlencode($value);
    … …  
    311315
    312316        return home_url($path);
     317    }
     318
     319    /** Return a redirect only for an exact operation alias on an archive route. */
     320    public static function operationAliasArchiveRedirect(string $url): string
     321    {
     322        $path = (string) wp_parse_url($url, PHP_URL_PATH);
     323        $archivePath = (string) wp_parse_url(home_url('/inmuebles/'), PHP_URL_PATH);
     324        if (!str_starts_with($path, $archivePath . 'gestion/')) {
     325            return '';
     326        }
     327        $suffix = substr($path, strlen($archivePath));
     328        if (!preg_match('~^gestion/([^/]+)(?=/|$)~', $suffix, $matches)) {
     329            return '';
     330        }
     331        $slug = rawurldecode($matches[1]);
     332        $canonical = PropertyTaxonomies::canonicalOperationSlug($slug);
     333        if ($canonical === $slug) {
     334            return '';
     335        }
     336        $suffix = 'gestion/' . rawurlencode($canonical) . substr($suffix, strlen($matches[0]));
     337        $query = (string) wp_parse_url($url, PHP_URL_QUERY);
     338        return home_url('/inmuebles/' . $suffix) . ($query !== '' ? '?' . $query : '');
     339    }
     340
     341    public function redirectOperationAliasArchiveUrl(): void
     342    {
     343        if (is_admin() || wp_doing_ajax() || (defined('REST_REQUEST') && REST_REQUEST)) {
     344            return;
     345        }
     346        $method = strtoupper((string) ($_SERVER['REQUEST_METHOD'] ?? 'GET'));
     347        if (!in_array($method, ['GET', 'HEAD'], true)) {
     348            return;
     349        }
     350        $target = self::operationAliasArchiveRedirect(wp_unslash((string) ($_SERVER['REQUEST_URI'] ?? '')));
     351        if ($target !== '') {
     352            wp_safe_redirect($target, 301, 'Homlity Real Estate');
     353            exit;
     354        }
    313355    }
    314356
    … …  
    337379
    338380        $legacyKeys = [
     381            'gestion',
     382            'tipo',
     383            'ciudad',
     384            'barrios',
    339385            'property_operation',
    340386            'property_type',
    … …  
    514560                if (!empty($_GET[$param])) {
    515561                    $terms = array_map('sanitize_text_field', (array) wp_unslash($_GET[$param]));
     562                    if ($taxonomy === PropertyTaxonomies::TAXONOMY_OPERATION) {
     563                        $terms = PropertyTaxonomies::expandOperationTermSlugs($terms);
     564                    }
    516565                    $taxQuery[] = [
    517566                        'taxonomy' => $taxonomy,
    … …  
    534583                }
    535584                $terms = [sanitize_title($qvValue)];
     585                if ($taxonomy === PropertyTaxonomies::TAXONOMY_OPERATION) {
     586                    $terms = PropertyTaxonomies::expandOperationTermSlugs($terms);
     587                }
    536588                $taxQuery[] = [
    537589                    'taxonomy' => $taxonomy,
  • homlity-real-estate/trunk/templates/parts/property-filter.php

    r3723270 r3737527  
    142142        'taxonomy' => $taxonomy,
    143143        'hide_empty' => in_array($taxonomy, $onlyPublishedOptions, true),
     144        'fields' => 'all',
    144145    ]);
    145146    if (is_wp_error($terms) || !$terms) {
    … …  
    147148    }
    148149    $currentValues = is_array($currentValue) ? $currentValue : [$currentValue];
     150    if ($taxonomy === PropertyTaxonomies::TAXONOMY_OPERATION) {
     151        $terms = PropertyTaxonomies::publicOperationTerms($terms);
     152        $currentValues = array_map([PropertyTaxonomies::class, 'canonicalOperationSlug'], $currentValues);
     153    }
    149154    $inputName = $multiple ? $name . '[]' : $name;
    150155    ?>
  • homlity-real-estate/trunk/templates/parts/property-operation-price.php

    r3623792 r3737527  
    1313
    1414use Homlity\PluginInmobiliario\Services\CurrencyService;
     15use Homlity\PluginInmobiliario\Services\CardPriceResolver;
    1516use Homlity\PluginInmobiliario\Services\PropertyPostType;
    1617use Homlity\PluginInmobiliario\Services\PropertyTaxonomies;
    … …  
    3435    ? mb_strtolower($operationTerm->slug . ' ' . $operationTerm->name)
    3536    : '';
    36 $isVenta    = in_array($baseOperationId, [2, 3], true) || strpos($opSlug, 'venta') !== false;
    37 $isArriendo = in_array($baseOperationId, [1, 3], true) || strpos($opSlug, 'arriendo') !== false;
     37$operationTypes = CardPriceResolver::operationTypes($baseOperationId, $opSlug);
     38$priceLabels = CardPriceResolver::operationLabelsForTerm($operationTerm instanceof \WP_Term ? $operationTerm : null);
     39$isVenta    = $operationTypes['sale'];
     40$isArriendo = $operationTypes['rent'];
    3841$hideZero   = ($s['hide_zero_values'] ?? 'no') === 'yes';
    3942
    … …  
    6669    ],
    6770    'price_sale'  => [
    68         'label' => __('Venta',          'homlity-real-estate'),
     71        'label' => $priceLabels['sale'],
    6972        'value' => ($priceSale !== '' && $priceSale !== null)
    7073            ? homlity_plugin_apply_filters('homlity_plugin_format_price', null, $priceSale, $currencySale)
    … …  
    7275    ],
    7376    'price_rent'  => [
    74         'label' => __('Arriendo',       'homlity-real-estate'),
     77        'label' => $priceLabels['rent'],
    7578        'value' => ($priceRent !== '' && $priceRent !== null)
    7679            ? homlity_plugin_apply_filters('homlity_plugin_format_price', null, $priceRent, $currencyRent)
  • homlity-real-estate/trunk/vendor/autoload.php

    r3729219 r3737527  
    2323require_once __DIR__ . '/composer/autoload_real.php';
    2424
    25 return ComposerAutoloaderInit2634c38bb05d88eb3252b0a47e517ebb::getLoader();
     25return ComposerAutoloaderInit9ed91c3af774bd98d27da333ef900c0a::getLoader();
  • homlity-real-estate/trunk/vendor/composer/autoload_psr4.php

    r3729219 r3737527  
    99    'Svg\\' => array($vendorDir . '/dompdf/php-svg-lib/src/Svg'),
    1010    'Sabberworm\\CSS\\' => array($vendorDir . '/sabberworm/php-css-parser/src'),
    11     'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src', $vendorDir . '/psr/http-factory/src'),
     11    'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-factory/src', $vendorDir . '/psr/http-message/src'),
    1212    'Psr\\Http\\Client\\' => array($vendorDir . '/psr/http-client/src'),
    1313    'Masterminds\\' => array($vendorDir . '/masterminds/html5/src'),
  • homlity-real-estate/trunk/vendor/composer/autoload_real.php

    r3729219 r3737527  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderInit2634c38bb05d88eb3252b0a47e517ebb
     5class ComposerAutoloaderInit9ed91c3af774bd98d27da333ef900c0a
    66{
    77    private static $loader;
    … …  
    2525        require __DIR__ . '/platform_check.php';
    2626
    27         spl_autoload_register(array('ComposerAutoloaderInit2634c38bb05d88eb3252b0a47e517ebb', 'loadClassLoader'), true, true);
     27        spl_autoload_register(array('ComposerAutoloaderInit9ed91c3af774bd98d27da333ef900c0a', 'loadClassLoader'), true, true);
    2828        self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
    29         spl_autoload_unregister(array('ComposerAutoloaderInit2634c38bb05d88eb3252b0a47e517ebb', 'loadClassLoader'));
     29        spl_autoload_unregister(array('ComposerAutoloaderInit9ed91c3af774bd98d27da333ef900c0a', 'loadClassLoader'));
    3030
    3131        require __DIR__ . '/autoload_static.php';
    32         call_user_func(\Composer\Autoload\ComposerStaticInit2634c38bb05d88eb3252b0a47e517ebb::getInitializer($loader));
     32        call_user_func(\Composer\Autoload\ComposerStaticInit9ed91c3af774bd98d27da333ef900c0a::getInitializer($loader));
    3333
    3434        $loader->register(true);
    3535
    36         $filesToLoad = \Composer\Autoload\ComposerStaticInit2634c38bb05d88eb3252b0a47e517ebb::$files;
     36        $filesToLoad = \Composer\Autoload\ComposerStaticInit9ed91c3af774bd98d27da333ef900c0a::$files;
    3737        $requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
    3838            if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
  • homlity-real-estate/trunk/vendor/composer/autoload_static.php

    r3729219 r3737527  
    55namespace Composer\Autoload;
    66
    7 class ComposerStaticInit2634c38bb05d88eb3252b0a47e517ebb
     7class ComposerStaticInit9ed91c3af774bd98d27da333ef900c0a
    88{
    99    public static $files = array (
    … …  
    6060        'Psr\\Http\\Message\\' =>
    6161        array (
    62             0 => __DIR__ . '/..' . '/psr/http-message/src',
    63             1 => __DIR__ . '/..' . '/psr/http-factory/src',
     62            0 => __DIR__ . '/..' . '/psr/http-factory/src',
     63            1 => __DIR__ . '/..' . '/psr/http-message/src',
    6464        ),
    6565        'Psr\\Http\\Client\\' =>
    … …  
    670670    {
    671671        return \Closure::bind(function () use ($loader) {
    672             $loader->prefixLengthsPsr4 = ComposerStaticInit2634c38bb05d88eb3252b0a47e517ebb::$prefixLengthsPsr4;
    673             $loader->prefixDirsPsr4 = ComposerStaticInit2634c38bb05d88eb3252b0a47e517ebb::$prefixDirsPsr4;
    674             $loader->classMap = ComposerStaticInit2634c38bb05d88eb3252b0a47e517ebb::$classMap;
     672            $loader->prefixLengthsPsr4 = ComposerStaticInit9ed91c3af774bd98d27da333ef900c0a::$prefixLengthsPsr4;
     673            $loader->prefixDirsPsr4 = ComposerStaticInit9ed91c3af774bd98d27da333ef900c0a::$prefixDirsPsr4;
     674            $loader->classMap = ComposerStaticInit9ed91c3af774bd98d27da333ef900c0a::$classMap;
    675675
    676676        }, null, ClassLoader::class);
Note: See TracChangeset for help on using the changeset viewer.