Dynamic creation of a folder

Author Message

Marat M.

Tuesday 31 May 2005 9:03:35 am

Hi,

The site I create now is not very difficult. Almost 90% of all the necessary work is template programming which is rather simple. But the remaining 10% of functionality are far beyond my knowledge and I hope someone will help me with.

First, I have established a simple shop and customized the product class the way I want it.
Now I need two main things that, as I'm convinced, can be implemented in eZpublish:

1. I have a folder in my content tree. Let's name it 'Purchased'. I want a subfolder automatically created each time a new user is registered. The name of a sub-folder will be the same as username.
For instance, I have three users (and their usernames) recently registered with my system - User1, User2, User3. So, the tree should look like:


 Purchased (folder)
   |
   |- User1 (folder)
   |- User2 (folder)
   |- User3 (folder)

I anticipate that I should use a workflow 'content-publish-after'. But I have really no clue on how to do it. I cannot trace in documentation some more detailed explanation on using the workflows, extensions and related stuff.

2. When a user clicks 'Confirm purchase' (or, 'Checkout', no matter) the chosen products (included in the order) are moved to his personal folder (with his username) and await approval by administrator. Since then these products are NO LONGER SHOWN in the public shop. When they are approved they will be published in the user's personal folder (Purchased/[Username]).

I guess I should use some function to move content from one location (node) to another. But what function and how to use? I wish I could find a few pages of documentation that fit my case.

I do not ask for a ready code :) But if someone could show me the way where I can find additional information I would greatly appreciate it.

Thanks,
-Marat

Clemens T

Thursday 02 June 2005 2:34:58 am

I'm not sure if this is what you want, but take a look here:
http://www.ez.no/community/contribs/hacks/object_creator
Greets,
Clemens

Marat M.

Thursday 02 June 2005 4:45:47 am

Thanks, Clemens,

I reviewed that page but it is simply takes off the standard EZPublish functionality as for the creation of objects pushing submit button. As for me - I would like to implement object creation behind the scenes, so that the only button the user has to push would be the "Register" button.

However, in the extension description I found the following paragraph:

You can include it directly and create objects
with a one line function call. See 
"ObjectCreator/modules/ObjectCreator/ezobjectcreator.php".

And what does he mean by one line function call?

Thanks,
Marat

Marat M.

Sunday 05 June 2005 3:44:52 am

Ok. I see that I should create two workflows:

1. Will create a folder behind the scenes after the user logon.

2. Will move the product from the 'Shop' folder to 'Purchased/[Username]' folder after the checkout.

Am I right thinking of an event as a piece of PHP code that is created as an extension? So when you set up a workflow and a trigger function, the latter is simply executes this piece of code?

Another question - what is the connection between template code and extension code (PHP code)? Well, if I want to send some parameters from template code to the extension how can I do that?

Best regards,
-Marat

Xavier Dutoit

Sunday 05 June 2005 4:17:46 am

Hi,

Well, create the folder when the user is created (content creation, multiplexed by the class type user), not each time he/she logs on ;)

Yes, that basically a php file. Have a look there http://www.ez.no/ez_publish/documentation/development/extensions/workflow_events/creating_a_new_event

and go to the contrib area to grab one of the few existing ones as an inspiration.

What's the parameter you want to share between the template and the extension ? don't get your question.
X+

http://www.sydesy.com

Marat M.

Sunday 05 June 2005 6:21:40 am

I tried to understand something from this thread:

http://www.ez.no/community/forum/developer/how_can_we_create_content_objects_from_code

But I'm afraid I don't understand too much from the code. It seems that the code is a mix of standard PHP and some special eZpublish functions. I think I have to hire some ez programmer to do the task. A couple of hours will be enough to complete this for a person with a good knowledge of ezpublish.

Once more:

1. I need a folder to be created each time a new user is registered in the system. That folder will be his 'personal' folder with the name just like the user's username.
2. I need to have the products in the basket moved from the 'Shop' folder and published in the current (logged in) user's folder.

Maybe I have to uncover the structure of my site a bit to make my posts more understandable. It's pretty simple. :)
This is a simple shop of informational products. There is only one type (class) of product. It has 20 attributes. But only two of them - title and short_description are shown to the public in the shop. Once a buyer buys products each one is shown in his personal area on the site along with the rest 18 attributes. What is important - after a product is bought it is removed from the public area, i.e. it is unique (can be bought only once by someone).

It is obvious that it's much more easier to grab and show the contents of user's personal folder in his personal area than to separate 'bought' and 'still on sale' products in some other way. That is why I need a new folder created when a new user signs up.

So, how are the products brought into the personal folder? When a buyer clicks 'Checkout' the chosen product/products are removed from the 'Shop' (public) folder and published in his own Purchased/[Username] folder.

And the last step. You might wonder - how can I show the product to a buyer immediately after checkout when there is no payment has been made yet. The answer is - the products will be placed in his folder upon the approval by the administrator. Each time a buyer clicks 'Checkout' the chosen products are removed from the public shop and appear in the administration collaboration area where I can approve them. After the approval, the buyer can safely review them.

As for template progamming - fetching and showing the contents - I can do all that myself. I need only the core - making the work that is related to PHP and establishing workflow events.

Let me know, if you have more questions, and thanks for your help.

Best,
-Marat

Marat M.

Monday 06 June 2005 1:24:11 am

Can anyone help me with this? I agree to pay a certain sum.

-Marat

Xavier Dutoit

Tuesday 07 June 2005 1:25:45 am

Hi,

Don't know if it's inline with the rules of the forum to offer work or services on this forum.

Anyway, the problem you still have to solve is how to take the "product" node out of the catelog, "hide" it somewhere not visible from the buyer until an admin approve the order.

The approval mechanism won't be enough, but they are solutions to deal with that (using another section for that comes to my mind, but they are probably others).

I'd suggest to contact ez to see for the bespoke dev, otherwise if you're willing to release these events with a GPL licence, you can contact me ez {AT} sydesy {DOT} com

X+

http://www.sydesy.com

Marat M.

Wednesday 08 June 2005 6:57:12 am

Hi, Xavier,

I sent you a letter. Have you received it?

-Marat

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.