Share - Coding Question

Ken Rich
Ken Rich
@ken-rich
8 years ago
926 posts
This concerns the "Combined Sales" module I built with Aparna.

If I share the module URL to Facebook, I get the same picture and description as if I share my profile (bio/profile pic). It doesn't use the data available in the form update/create fields of the module.

However, if i share a detail page created by the module, I get the correct data, as provided by the form create/update (see attached).

My question is, how do I get that data to be shared with the module URL http://kenrich.me/sales instead of http://kenrich.me/sales/27 (or whatever item number the profile ends up with after numerous creations/deletions/creations).

On my profile 27 is the current item_id and /sales/27 is the uri There is only one item allowed to be created by the module as the whole point is to produce one page URL for promotions that has all saleable items listed or linked.

It seems to me, there should be a way to make it so that the simplest URL, the module URL which is profile/sales carries the right share information.

When I do a debug to the detail page that shares properly I see the URL's under $post

$_post}
Array (6)
_uri => "/sales/27"
module_url => "ken-rich"
module => ""
option => "sales"
_1 => "27"
_profile_id => "1175"

The data for OG info is there under $item. This is what's missing from the item_index.tpl

sales_image => ""
sales_image_name => "Ken's Sales.png"
sales_title => "Ken's Store"
sales_text => "This is a store with products and services from Ken Rich. An ebook, CD, video..."

I'm thinking (maybe I'm nuts) that there are 3 possible scenarios to achieve the desired result (proper sharing at the module URL profile/sales).

1) Perhaps the tab and url for the module can be linked to the detail page instead of the item_index.tpl and then what is displayed and shared by the module URL (profile/sales) would be the detail page (already sharing properly).

2) Or keep the Sales tab (and module URL) linked to the item_index.tpl but alter the share tpl to use the data from the form designer create/update available at $item of the uri_1 instead of the module url.

3) Or this is something that requires modifications at the PHP level of the module and scenario 1 and 2 are not viable paths.

Capture333.JPG.jpg
Capture333.JPG.jpg  •  43KB




--

Ken Rich
indiegospel.net

updated by @ken-rich: 07/28/16 07:59:04AM
Ken Rich
Ken Rich
@ken-rich
8 years ago
926 posts
Whoever built the "Service Shop" module appears to have attempted the same thing I am attempting.

However, their code doesn't work and will not work for my application either (for the same reason). A debug reveals that $_post._1 is not available to the irem_index.tpl

{if isset($_post._1) && strlen($_post._1) > 0}{$_post._1}{else}
Show Whatever You Want As Default{/if}

Can someone smarter than me come up with a code that will work?

So it will need to be:

{if (a item has been posted) display it at the module URL, on (iframed or listed) the item_index, or in lieu of it (url reassigned from index to detail)} (else} display whatever You Want{/if}



--

Ken Rich
indiegospel.net

updated by @ken-rich: 04/25/16 06:57:17PM
Ken Rich
Ken Rich
@ken-rich
8 years ago
926 posts
I got around the big issue of how to get the module URL to show my storefront on item_index.tpl (since I don't know how to take it off that default) and still be shareable with the proper OG metadata from the form.

I added a share button which opens the identical detail page, complete with share tools.

Go to http://kenrich.me/sales and click the green share button and see what happens.

It's a novel approach. I have to think outside of the box by nature because I don't understand the box - lol.


--

Ken Rich
indiegospel.net