Password protect category pages

  • Posts: 76
  • Thank you received: 4
  • Hikashop Business
11 years 8 months ago #96537

I am trying to set up an events photography site using Hikashop to process orders and payments.

The events will be wide ranging and will include some events with children competing. I therefore want to restrict the users viewing photos by issuing a password at the event. Those with a password can then use the password to gain access to photos of the relevant event.

Is there any way to insert a step in Hikashop which requires users to enter a password before they get to the relevant page - this would be the equivalent of a category page.

If I can't do this using Hikashop either via the business version or otherwise, does anyone know a way I can achieve this using Joomla?

Thanks for any help.

Regards
D


DunxMax

The more we learn the less we know.

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

  • Posts: 13201
  • Thank you received: 2322
11 years 8 months ago #96617

Hi,

I think that you have to use the custom fields on the table category to set a password by category.
Then edit the view which is listing the products, generally "product / listing_img_title" and in this view add a check for the password.

If the category has a password AND the user has no session token about this password > restrict the access and only display a password field.
When the customer enter the password, create a session token.
But if the user has a token in her session saying that he has already entered the password, show the content of the listing.

This is probably the easiest way to achieve that.

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

  • Posts: 76
  • Thank you received: 4
  • Hikashop Business
11 years 8 months ago #96638

Thanks for the reply - I understand the solution, it's not something I've done before, but will have a go when I get a chance.

Do I need the business version to add the custom field? It's not a problem I am going o purchase it in the near future, but just wondering if I will need it to do this task.

Dunxmax


DunxMax

The more we learn the less we know.

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

  • Posts: 13201
  • Thank you received: 2322
11 years 8 months ago #96682

Yes the custom fields for this type of table are in the business version.
Using the custom fields will allow you to save your time.

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

  • Posts: 76
  • Thank you received: 4
  • Hikashop Business
11 years 8 months ago #96686

That's no problem - I shall buy it in the next week or so. Looking forward to seeing what other things I can do with the business version.


DunxMax

The more we learn the less we know.

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

  • Posts: 76
  • Thank you received: 4
  • Hikashop Business
11 years 7 months ago #100775

Hi Xavier,

I know its been a while since I last posted on this thread, but this is the first day I've had a chance to have a go at your suggestion.

I've bought the business version of Hikashop.

I have gone to custom fields and added a "passkey" field in the "category" table.

I have set it to have a field type of "Text".
You then say to do this:

Then edit the view which is listing the products, generally "product / listing_img_title" and in this view add a check for the password.

If the category has a password AND the user has no session token about this password > restrict the access and only display a password field.
When the customer enter the password, create a session token.
But if the user has a token in her session saying that he has already entered the password, show the content of the listing.


Unfortunately I am not a coder and I have no idea how to go about coding the above. Can you help me in anyway or help me get started.

Thanks in advance.

D


DunxMax

The more we learn the less we know.

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

  • Posts: 13201
  • Thank you received: 2322
11 years 7 months ago #100939

Hi,

It's a support forum for help in configuration and bug correction, not for customizations.
You can post a request in the commercial jobs section of this forum.

What you need is a check on the custom field, something like:

if(!empty($this->element->passkey) && $app->getUserState( HIKASHOP_COMPONENT.'.passkey') != $this->element->passkey){
	// Display only a form to enter the passkey
		// > when pressing submit, save the value in session, and reload the page.
		// To save in session, you can use: $app->setUserState( HIKASHOP_COMPONENT.'.passkey',JRequest::getVar('passkey',''));
}elseif(empty($this->element->passkey) || $app->getUserState( HIKASHOP_COMPONENT.'.passkey') == $this->element->passkey){
	// Display the the code
}
Add it in the view "product / listing" before:
if(($this->params->get('show_image') && !empty($this->element->file_path))|| ($this->params->get('show_description',!$this->module)&&!empty($this->element->category_description))){

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

  • Posts: 76
  • Thank you received: 4
  • Hikashop Business
11 years 7 months ago #100961

Xavier,

Thanks - I will have a go with this later.

I understand your comment about customisation and I'm sorry if I'm posting in the wrong part of the forum, I honestly didn't realise there was a commercial job section. Either way I need to get this working, so once again thank you and I appreciate your time.

D


DunxMax

The more we learn the less we know.

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

  • Posts: 76
  • Thank you received: 4
  • Hikashop Business
11 years 6 months ago #101644

HI Xavier,

I added the code and got this error:

"Fatal error: Call to a member function getUserState() on a non-object in mysite/templates/js_memo/html/com_hikashop/product/listing.php on line 117"

I know this should be a commercial job - it would make sense for me to pay you, seeing as we are half way through. Are you willing to take this on?

Regards

Duncan


DunxMax

The more we learn the less we know.

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

  • Posts: 13201
  • Thank you received: 2322
11 years 6 months ago #101663

Hi,

That's probably because $app is not declared, you can use '$app = JFactory::getApplication();'

You can post this request on the commercial Jobs, we don't do custom works, so many features to implement in HikaShop :)

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

Time to create page: 0.080 seconds
Powered by Kunena Forum