Join our new community forum for support & discussion

Join Now

Home Support Extensions Marketplace Problems showing the price in block secondary and page primary positions

Problems showing the price in block secondary and page primary positions

  • Author
    Posts
  • bb-

    Hi!

    Before Marketplace I used an attribute of my own and named it price. I could choose exactly how I wanted to display it. What I wanted to show before and after the attribute value. I could also choose where to show it block/page primary/secondary.

    With the market place plugin activated I can’t do that anymore, it only show in the block primay and page seconday position.

    Or is it me not finding the right settings?

    With best regards,

    bb-

    bb-

    Hi again, also a small bug(?) in search alerts. It saves the place of the search but doesn’t display the place in the Dashboard next to categories. Also, wouldn’t it be neat if the user could save the attributes in the search alert?

    Also, the term “view listings” (the eye icon in the search alerts dashboard) can’t be found in the search alert plugin. I need to translate it with loco translate from the main plugin. I think it would be easier for the users if the term was found in the search alerts plugin.

    With best regards,

    bb

    ihor developer

    1. It’s not possible yet, because the price attribute is hard-coded by the Marketplace extension, and its format can be set in WooCommerce settings (currency, its position, etc). If you want to set some custom format it’s still possible, but via the code snippet.

    2. Search alerts should save all the attributes selected in the filter form, but the location is not supported yet (but it should be saved anyway).

    3. This string is fetched from the main HivePress plugin, please try translating it in Loco Translate/Plugins/HivePress section.

    bb-

    Hi ihor and thanks for your fast response!.

    1. Will it be possible in the next version? With woo commerce you can’t choose to display the price like this “my custom string1 %price% my custom string 2”. Also it’s nice to be able to choose where to show the price on page and block.

    2. The location is saved but doesn’t show in the dashboard, will it?

    3. Already done, was a suggestion to make the plugin more customizable.

    With best regards,

    bb

    ihor developer

    1. This is on the roadmap, but will not be available in the next version. Hard-coded fields like title, description, price can’t be managed in the same way as attributes, but it’s possible with HivePress API:

    add_filter(
    	'hivepress/v1/models/listing/attributes',
    	function( $attributes ) {
    		if ( isset( $attributes['price'] ) ) {
    			$attributes['price']['display_format'] = 'custom %value% format';
    			$attributes['price']['display_areas']  = [
    				'view_block_primary',
    				'view_page_primary',
    				'view_block_secondary',
    				'view_page_secondary',
    			];
    		}
    
    		return $attributes;
    	},
    	1000
    );

    2. Thanks, I added your suggestion to the backlog so it will be implemented sooner or later. It requires integration between the extensions, currently the Search Alerts extension is integrated with the core only.

    suncatcher

    Hi ihor,

    Regarding the code snippet in your last reply with filter hivepress/v1/models/listing/attributes.

    I used this code snippet:

    add_filter(
        'hivepress/v1/models/listing',
        function( $model ){
    
            $model['fields']['new_field']['label'] = esc_html__( 'New Field', 'hivepress' );
            $model['fields']['new_field']['type'] = 'text';
            $model['fields']['new_field']['_alias'] = 'new field';
            $model['fields']['new_field']['_external'] = true;
            $model['fields']['new_field']['display_format'] = '%label%: %value%';
            $model['fields']['new_field']['display_areas'] = [
                'view_block_primary',
                'view_page_primary',
                'view_block_secondary',
                'view_page_secondary',
            ];
    
            return $model;
    
        }
    
    );

    Then I added that field to this filter hivepress/v1/forms/listing_update and set ‘required’ => true.

    But after listing submission and approval of the listing, that newly added field didn’t display anywhere, neither block nor page of primary/secondary part.

    However, in the listing edit form, the value of the newly added field is correctly fetched, which means the data was stored correctly.

    What might be wrong?

    Thanks in advance.

    ihor developer

    If you want to add a new field to both the listing model and its update form please consider adding an attribute in Listings/Attributes section, code customizations are not required in this case. You can mark a custom attribute editable and required, and assign it to any of the available display areas.

    Mishoo

    @ihor I have the following issue related to this topic (Rentalhive): the price is not showing correctly block_secondary. It is showing an incorrect translation from locoTranslate instead. Everywhere else, no issues so far with the snippet below.

    Selector:
    #content > div > div > div > footer > div > div > div > div > article > footer > div.hp-listing__attributes.hp-listing__attributes--primary > div

    I have used the following php snippet suggested in another thread by you which works just fine everywhere else:

    add_filter(
    	'hivepress/v1/models/listing/attributes',
    	function( $attributes ) {
    		if ( isset( $attributes['price'] ) ) {
    			$attributes['price']['display_format'] = '%value% / night %icon%';
    		}
    
    		return $attributes;
    	},
    	1000
    );

    What am I not seeing here? Any help is much appreciated!

    Thanks in advance.

    Mishoo

    ihor developer

    The snippet seems to be ok, it should change the Price display format. Please make sure that there’s no custom Price attribute that may conflict with it, if the translation is incorrect you can check different Loco Translate sections (e.g. HivePress or HivePress Marketplace in Loco/Plugins).

Viewing 9 posts - 1 through 9 (of 9 total)

New Reply

This forum has been archived and is no longer accepting new posts or replies. Please join our new community forum for support & discussion.