Page 1 of 1

Form linked to gallery image module

Posted: 02 Apr 2011, 16:34
by vikreh
Hi I would like to be able to let a customer look at images in the gallery image module. When the customer sees an image they like, I would like to make it possible for them to press a "buy" button that opens a form. I need a little bit of direction about the database queries and how to make this happen.

Can anybody point me in the right direction?

I'll clarify a bit. I want to sell prints of pictures not downloads. Because of this I need to make a dynamic form that can add more than one instance of the same picture in the form; in case the customer want to buy diffent sizes and qualities. After the client is done with the first picture it should be possible to continue to add more orders to the form of other pictures.

My site is not up yet and this is an important feature for me since I want my clients to be able to chose not only which pictures to buy but also what print quality.

It is also important because with the help of a form I can submit the order directly to the company that prints. Instead of manually handle every order. Also this would make it possible for me to let the printing company handle the delivery to my clients which reduces handling for me.

I am running Joomla 1.6.1 and I have the latest phoca installed. It is also important for me to understand what's going on. Because of this I would like to build as much as possible myself (without making it an overkill)

Viktor

Re: Form linked to gallery image module

Posted: 07 Apr 2011, 22:42
by Jan
Hi, no experiences for now yet, in Joomla! 1.5 maybe the possible solution can be:
https://www.phoca.cz/documents/2-phoca-g ... ntegration

Jan

Re: Form linked to gallery image module

Posted: 13 Apr 2011, 00:14
by vikreh
Hi again,

Currently I am evaluating Smartformer which seems like a good choice for my requirements, since PHP, HTML and other code can be implemented in all items in the form. I don't know for sure if I'll use it though. Time will tell. If I manage to make a good implementation of it. I can post a demo user here later. If someone is interested that is? As for Phocagallery I think it is very good and I will put my money where my mouth is to support your project.

My biggest problem now is learning how to query the database, but I am getting there slowly.

Viktor

Re: Form linked to gallery image module

Posted: 13 Apr 2011, 21:50
by vikreh
Hi again,


I am having trouble getting the category id for the logged in user.

So far I have managed to pull the user id by:

global $my;
$my =& JFactory::getUser();
if (isset ($my->id)) echo $my->id;

However getting from there to pulling the category id seems difficult since I am having trouble passing the $my->id to a variable. Like I said I am a real noob. Can somebody explain what "->" means I've googled it without luck.

And also like I stated above I need the category id for the logged in user in order to pull images related to that user from the database in to the form.

Viktor

Re: Form linked to gallery image module

Posted: 17 Apr 2011, 13:40
by Jan
Hi, maybe this is more a question on Joomla.org forum maybe on PHP forum (-> to know what is object oriented php code) :idea:

Re: Form linked to gallery image module

Posted: 18 Apr 2011, 01:17
by vikreh
Hi again thanks for the explanation and yes this may be more a question for another type of forum.

If somebody else need to make similar queries for registered user ACL level pictures together with forms this code can get you there.

$my=& JFactory::getUser();
$db=& JFactory::getDBO();
$a=& $my->id;
$query="SELECT id FROM jos_phocagallery_categories WHERE accessuserid='$a'";
$db->setQuery($query);
$r=$db->loadResult();
$queryc="SELECT filename FROM jos_phocagallery WHERE catid='$r'";
$db->setQuery($queryc);
$results=$db->loadResultArray();

The $results variable, in this case contains the filenames stored in Phocagallery for a specific category ACL level.

I hope you don't mind - Jan
Regards / Viktor

PS I still think your application is great and I will most likely use it on my site for the better looking parts and for image handling. DS

Re: Form linked to gallery image module

Posted: 18 Apr 2011, 23:03
by Jan
Hi, thank you for the guide.

Jan