RSS Feed Customisation

  • Posts: 136
  • Thank you received: 1
10 years 1 month ago #174053

-- HikaShop version -- : 2.3.3
-- Joomla version -- : 3.3.3
-- PHP version -- : 5.5
-- Browser(s) name and version -- : Chrome

Hi Guys,

I need to modify my RSS feed.

What I need to add are the following tags for each item/product.
tag - comment
company - the business name - product custom field
companyAddress - the business address - product custom field
sold - qty of items sold for a product
location - business location - product custom field
value - retail price
percentage - discount price - custom field
offer - meta description
image - image file location url
url - product page SEF URL (alias)
end time - Product available until

Can anyone give me some tips here. e,g,
- which php file to modify for the feed
- how to get the custom fields for a product
- how to get the image file url location
- how to get the Product available until field.

Really appreciate any assistance on how to edit this!

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
10 years 1 month ago #174081

Hi,

You have to edit the file "components/com_hikashop/views/product/view.feed.php".
The custom fields of a product are stored in the product table so present in the product variable ($row in the foreach).

The image file url is already get in the file, and the "until" field is too a value stored in the product variable.

The following user(s) said Thank You: jacorr27

Please Log in or Create an account to join the conversation.

  • Posts: 136
  • Thank you received: 1
10 years 1 month ago #174503

Hi Xavier,

I added the following to the view feed.

$descr = $this->escape( $product->product_meta_description );
$descr = html_entity_decode( $descr );

$company = $this->escape( $product->merchant_name );
$company = html_entity_decode( $company );

$companyAddress = $this->escape( $product->addressline1 );
$companyAddress = html_entity_decode( $companyAddress );

$sold = $this->escape( $product->product_sales );
$sold = html_entity_decode( $sold );

$location = $this->escape( $product->deal_location );
$location = html_entity_decode( $location );

$value = $this->escape( $product->product_msrp );
$value = html_entity_decode( $value );

$percentage = $this->escape( $product->discount_percentage );
$percentage = html_entity_decode( $percentage );

$offer = $this->escape( $product->deal_price );
$offer = html_entity_decode( $offer );

$image = $this->escape( $product->image );
$image = html_entity_decode( $image );

$url = $link;

$end = $this->escape( $product->product_name );
$end = html_entity_decode( $end );

$item = new JFeedItem();
$item->title = $title;
$item->description = $descr;
$item->company = $company;
$item->companyAddress = $companyAddress;
$item->sold = $sold;
$item->location = $location;
$item->value = $value;
$item->percentage = $percentage;
$item->offer = $offer;
$item->image = $image;
$item->end = $end;

$doc->addItem( $item );

All I get is a blank item.

Can you give me any help here on how to fix this?

Is there a model that needs to be modified?

Much appreciated!

Thanks,
Mike

Please Log in or Create an account to join the conversation.

  • Posts: 136
  • Thank you received: 1
10 years 1 month ago #174614

Hi Xavier,

Any chance you could help me out here?

Appreciate the help as this is a critical change for my business! :)

Thanks,
Mike

Last edit: 10 years 1 month ago by jacorr27.

Please Log in or Create an account to join the conversation.

  • Posts: 82864
  • Thank you received: 13372
  • MODERATOR
10 years 1 month ago #174895

Hi,

I'm not sure how adding fields like that to your RSS feed are critical to your business since such extra fields do not exist in the RSS specification and thus won't be understood by any RSS reader:
cyber.law.harvard.edu/rss/rss.html
It's technically possible to add such fields in a RSS feed but RSS readers won't read them so there is no point.
And since it's not something standard, the Joomla feed system doesn't support that either, so before adding extra fields like that in HikaShop, you would first have to modify the Joomla feed system in order to support them.

In short, I don't see the point and I don't recommend such modifications.
If you want to add extra data to the RSS, then simply append it to the description of the $item object like that:

$item->description = $description.'<br/>Company:'.$company;

Please Log in or Create an account to join the conversation.

  • Posts: 136
  • Thank you received: 1
10 years 1 month ago #174906

HI Nicolas,

Yes it isn't standard.

The feed is being amended for the purpose of being used by my partners which require this specification for the feed.

The reason being, is they have many other partners which all have this spec and it is utilised to further promote my products in my site.

It is critical for my business as this is around 40% of my traffic driver and has high conversion rates.

The example you provided would not work as the tags are specific.

Thanks anyway for the help!!! I have a developer sorting this all out for me now and will have a custom RSS feed for this purpose by tomorrow :)

Cheers,
Mike

Please Log in or Create an account to join the conversation.

  • Posts: 82864
  • Thank you received: 13372
  • MODERATOR
10 years 1 month ago #174968

Hi,

Great then !
Indeed, that's a very specific need :)
It was a good call to have a developer do that for you as it's not something that can easily be changed.

Please Log in or Create an account to join the conversation.

Time to create page: 0.082 seconds
Powered by Kunena Forum