- Posts: 224
- Thank you received: 8
TUTORIAL: How to hide/show site contents based on Hikashop product(s) bought
I follow up this forum thread www.hikashop.com/forum/install-update/89...ought-by-a-user.html after my developer wrote a little plugin to solve a issue we had
PROBLEM:
How to hide/show website content (anywhere on the website) based on the Hikashop products a user bought
USEFUL FOR:
There are many uses for this, we will mainly use it to give clients access to certain pages where they can watch and download videos.
We also can give access to download links for files on Amazon s3 (this is a nice workaround if you have big files and don't want to upload them on your server to be downloaded through Hikashop).
To do this create a page for each file you want to be downloaded after a succesfull order, place there a link to the file on Amazon S3, and use a script like Linklok by Vibralogix to protect your Amazon S3 link.
Then send the client to that page after a succesfull Hikashop order and show/hide the link based on the product ID he bought.
WHAT YOU NEED:
For this solution to work you need
- The Pro version of Conditional Content plugin by Regular Labs (really easy to use, tutorials on their website)
- The Plugin attached to this thread
HOW TO INSTALL:
The plugin must be uploaded manually to your website, instructions are in the plugin folder
EXAMPLE USAGE (this is the sintax you need to paste on your page):
Note: the plugin is written to check both Hikashop products and Emerald subscriptions, but you can just use it just for Hikashop
Hikashop product (1)
You {show php="return hasBoughtHikashopProducts(51)"} have {show-else} haven't {/show} bought HIkashop product ID 51
Hikashop products (bought more than 1)
You {show php="return (hasBoughtHikashopProducts(51) && hasBoughtHikashopProducts(30))"} have {show-else} haven't {/show} bought product with ID 30 AND ID 51
Hikashop products (check array)
You {show php="return hasBoughtHikashopProducts(array(30,51))"} have {show-else} haven't {/show} bought Hikashop product ID 30 OR 51
Emerald subscription
{show php="return hasEmeraldSubscription(17)"}User has been subscribed to subscription ID 17{/show}
Emerald subscriptions (check array)
You {show php="return hasEmeraldSubscription(array(15,16))"} have {show-else} haven't {/show} bought Emerald 15 OR 16
Hikashop product OR Emerald subscriptions
You {show php="return (hasBoughtHikashopProducts(51) || hasEmeraldSubscription(15))"} have {show-else} haven't {/show} bought Hikashop 51 OR Emerald 15
Emerald subscription + Hikashop products array
{show php="return (hasEmeraldSubscription(17) && hasBoughtHikashopProducts(array(51, 52)))"}User has been subscribed to subscription ID 17 and bought product with ID 51 or ID 52{/show}
Hope this will help!
Please Log in or Create an account to join the conversation.
I would recommend you to add a little check in your function.php file to check if the emeral file exists.
So if someone install the plugin without emerald, it won't generate a fatal error.
Please note that HikaSerial provides a plugin named "Serial Private Content" which provides a similar feature.
It allows to hide/show content depending the serials that a customer have (so the product he bought) and that plugin is also compatible with HikaSerial Subscriptions.
And we are always open to suggestions or ideas of improvements
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Please Log in or Create an account to join the conversation.
I would recommend you to add a little check in your function.php file to check if the emerald file exists.
So if someone install the plugin without emerald, it won't generate a fatal error.
Ops... sorry, I will ask the developer to make this update to the file.
Please note that HikaSerial provides a plugin named "Serial Private Content" which provides a similar feature.
It allows to hide/show content depending the serials that a customer have (so the product he bought) and that plugin is also compatible with HikaSerial Subscriptions.
Interesting, I googled around bu can't find many info on this plugin features, could you help me to understand if it would achieve the same as with the solution we developed?
- can extensive pieces of content be hidden? (eg. many nested divs with dynamic content in it)
- can an alternative content be showed if user has no serial?
- can the subscription be renewed with different payment methods (eg. offline) or just via paypal?
- can it send alerts automatically when subscription is about to expire?
thsi is all I can think about for now,
thank you!
Please Log in or Create an account to join the conversation.
We made a little documentation page :
www.hikashop.com/support/documentation/4...lprivatecontent.html
That plugin was a feature request in the HikaSerial support forum ; we release it but we did not got a lot of feedback on that and I admit that I forgot to write the documentation page.
Afterwards the plugin is a "content" plugin, so it is compatible with the Joomla content core system (article, search, etc) ; and you can even use the tags in components like product description, etc.
As a content tag, you can place all the content you want between the open and close tags.
You can also put a auto-closure tag and it will content all the content after the tag as the private content.
It support alternative content and also have an option to add a link to a buy a product to unlock the content.
Since it is based on "used serial", you can also activate an option to place a "consume" module instead of the private content ; so the customer could enter its serial into (and unlock the content).
Thanks to that, you can generate serials and give them manually to some customer ; they just have to enter the serial to link it to their account and have access to private content. It do not necessary need to buy a product with serial.
HikaSerial Subscription do work with paypal recurring but it is also fully compatible with all HikaShop payment plugin.
Customer can buy regular subscription and perform the renewal via the customer dashboard.
There is also a email notification system that you can configure for the dates/periods you want.
Feel free to try HikaSerial Subscription in our demo website !
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Please Log in or Create an account to join the conversation.
Please log in or register to see it.
Please Log in or Create an account to join the conversation.
@Jerome
Please, Can you help on have a workflow like:...Since it is based on "used serial", you can also activate an option to place a "consume" module instead of the private content ; so the customer could enter its serial into (and unlock the content)...
- Customer buy a "Serial" product
- A Serial is sent to him
- He can activate the Serial to see the content
- The Serial has an X time validity (from the moment ho bought the product and/or from the moment he activated it unblocking the content), after that the content will be hide again...
Please Log in or Create an account to join the conversation.
When the customer "have" the serial, the content is automatically displayed.
The "product id" that you have in the tag is to generate a link to the HikaShop product page so the customer can buy the product which will allow him to unlock the content.
A serial can't be consumed multiple time and as I just wrote, when the customer have the serial, the content is automatically available (in the meaning "always available").
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Please Log in or Create an account to join the conversation.
many thanks for your answer.
Please, What do you mean exactly with "always available" ?
Do you mean that still the Serial is valid the Private Content will be always available ?
By setting the Serial:
- "validity days"
- "time limited" an expiration date
we can manage the Private Content access time, Am I right ?
Please Log in or Create an account to join the conversation.
If the customer do have a serial in the pack, the content is available.
There is no "validity", no expiration, no number of usage ; you just have to own the serial.
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Please Log in or Create an account to join the conversation.
Many Thanks for your reply.
Sorry, but I'm not understanding, if the Private Content plugin "is not reading" the "validity days" / "time limited" parameters, What is the difference from the Private Content plugin and the new standard HikaShop hkshow/hkhide tags ?
Please, How can we provide Content Access for limited times periods ?
Please Log in or Create an account to join the conversation.
If you're using a subscription instead of a serial ; the plugin will verify if the customer has a valid (and active) subscription.
Regarding serials ; I gave you the working rule which cannot be change or bound.
The "time limited" generator is regarding the serial consumption and nothing else.
A serial is "assigned" then "used" during the consumption ; consumption which can trigger actions.
The mentioned tag is just checking for a "used" serial.
Now if you want to duplicate the plugin and add some custom features, it's still possible.
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Please Log in or Create an account to join the conversation.