Problems, need help? Have a tip or advice? Post it here.
9 posts Page 1 of 1
Hello,

Is there a way to change the default page ID for clonable pages?
By default it starts at around 1 I think. Can I make it start a 2300 for example?

It would be for a simple invoice system. So I must be able to set a specific start number for the invoices.

Thanks!
Hi,

I am afraid, no.
ID generation is totally the domain of MySQL server and Couch has no say in it.
Hi larin555,

I cannot see a reason why you would want control over the page ID except for page urls?

In which case, you could use custom routes (search the forum there is an advanced tutorial somewhere) to use an editable region as the source of the URL. E.g create an editable called invoiceID and use that to match the urls
The reason behind this is that my client needs a simple CRM, where he can create Proposals and contracts.
He is actually using another system and is now at Proposal around 2400. So once the new version of the CRM made with Couch will be done, he will have to be able to create proposals, from 2400 and up.

The only field I know in Couch that is always going up when creating new clonable pages is the ID. That's why I thought maybe I could say "For the Proposal page, the ID should start at 2400, so every pages created in there would have an ID starting at 2400, and will go up".

If there's a way to add a field that would generate a number that is always going up depending on how many pages you create, like the ID number, it would be fine too.

Any idea how I can achieve this? There's gotta be a way.

Thanks!
If there's a way to add a field that would generate a number that is always going up depending on how many pages you create, like the ID number, it would be fine too.

Yes. Add a text field first with predefined value as usual. Set that value as a fixed number temporarily and see if it displays well in your admin form view.

Next, the idea is to change dynamically that number - I guess it is fairly easy to use cms:pages and find programmatically the page with the desired latest highest number. Get this part working well before next step.

Finally, follow the Couch 2.0 tutorial about changing the way an editable is generated for the form (using cms:config_form_view section to customize this new editable) and where tutorial describes how to reach the point whereit says "enclosed content is dynamic", you can put prepared code to that place.
Thanks Trendoman, great ideas.

I found the idea of putting a field in a "Settings" page where I can enter the "start number" for invoices.
What I am wondering, is how can I make sure each new Invoices created are always a unique number, and always the number of the last invoice but adding +1 too.

Any ideas? Thanks!
Sorry for the bump. Was wondering if you guys had any ideas on how to achieve this?
Thanks a ton!
As it happens, I posted a solution literally just a few minutes back :)
viewtopic.php?f=8&t=11372

Please try it and let me know if it helps.
Exactly what I needed! Thanks!
9 posts Page 1 of 1
cron