Jump to content

Best way to auto generate SKU number?

Recommended Posts

The eCommerce software (Foxycart) I am using is asking for unique code for each item I add. So I will need a way to auto-generate a sky/code/whatever that the client can see in Processwire and then input into Foxycart. 

This is for the sale of music tracks and complete albums. The way I have it setup in Processwire is like this:

Artist Name

 - Albums

   - Album Name

      - Track 1 name

      - Track 2 name

      - etc ....

I was thinking of using just the ID of each track / album, but the ID isn't shown to the client using Processwire so that's a no-go unless I can find a way to have this displayed. What would you do? Ideas? I don't want the client randomly putting SKU codes in in order to avoid duplicated entries, etc.. So it would have to be unique. 


Share this post

Link to post
Share on other sites

i always use the processwire ID for the code in foxycart;

<input type='hidden' name='code' value='{$page->id}' />

Share this post

Link to post
Share on other sites

i always use the processwire ID for the code in foxycart;

<input type='hidden' name='code' value='{$page->id}' />

That' what I was going to do as well, however this is for digital goods and apparently the client needs a unique code(sku) for each product created in Foxycart (since digital goods needs to be created on the Foxy backend). I just noticed that the ID does show in the URL when editing in the Processwire backend so I may just tell the client to look in the URL. However, I am still open to suggestions. 

Are you using just the ID for digital goods?

Share this post

Link to post
Share on other sites

I don't know if you have any specific requirements for your SKU, but someone came up with something on SO:


You can also google creation of a GUID (globally unique ID). There is even a built-in php function:


Share this post

Link to post
Share on other sites

What i would do is have a custom management page with a table showing all the tracks and then i would output the page ID in it's own column so they could double click it and copy it into foxycart.

but short of that, yes you would need to grab the page id from the URL...

funny though - most labels i work with already have catalog #s for their albums;

a good sku setup would be the page for the album - page for the track (like 2034-9812) then you could at least see which tracks are part of the same album...

  • Like 2

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Jeannette
      Hello Fellows,

      I have a wonderful webshop, using PL and Padopt, a module developed by Julien Vaubourg and highlighted in ProcessWire Newsletter. Here is our shop: cheval-ami.fr
      I am looking for a new developer, helping me to keep the shop smooth and up to date.
      We would like to improve automated invoicing and worldwide shipping, getting DHL integrated and give people the possibility to create their personal accounts and be the nicest shop in the equine industry. We are still a young company, working all in german, english and french. We are very interested in a long time, kind and friendly relationship without any stress, but reliable reactivity in case of urgency. 
      We are based in Hamburg and near Paris and would prefere to work with somebody who is available to catch up around a table, at least sometimes.
      Contact: mail@cheval-ami.fr or +33 626 22 1000 or +49 170 20 28 215
      Thank you, Have a beautiful day,
    • By Marco Ro
      Hi everyone,
      a year ago we had put online a first version of our website, which didn't satisfy me much and had several bugs. This year I started working on a complete restyling, both in terms of functionality and graphic. I am very happy with the result obtained. Finally, last week we put this version online that I am proud to show you!
      Site EU: https://www.playwood.it/
      Site USA: https://www.us.playwood.it/
      It is an eCommerce for a small StartUp, the PlayWood, based in Reggio Emilia, Italy.
      The site is multilingual, has two areas of purchase and has two levels of registration. Redirectory based on the source IP for the USA customer and preferred language in the browser for the others countries. It has systems for use registration and sending emails dependent on specific actions, like: registration, purchase, request for quotes, information request, etc. Through the API the site communicates with external platforms such as the management software, Mailchimp and other systems to support marketing and company operations. 
      The site is constantly evolving, in the future we intend to add new features.
      The site was created with these modules:
      Padloper  Login/register Media Library ProCache PayPal Checkout Subscribe to Mailchimp Tracy Debugger Cookie Management Banner Continent and country names ImagePicker Field Map Marker External libraries:
      Spectre, scss framework Swiper slideshow verlok/lazyload fancybox
      Creating this site with ProcessWire represented a moment of strong professional growth. When I started I had little knowledge of some types of language, but Processwire and its APIs give me the ability to easily build pages, manipulate data and integrate any external library easily. Thus, I was able to deepen my knowledge more and more. So I wanted to thank the creators of the cms, who keeps it and who implements it, obviously all the people in the forum for the help they gave me, was very important.
      Thank you!


    • By benbyf
      Not new, but a website I've worked on for a year or so in continous development.
      I originally inherited the site from another web design company - upgraded PW and over the year added ecommerce using the Stripe module and a custom integration, revamped the frontend and added lots of new templates.
      Also did some frontend work on the shopify shop.

    • By kuba2
      I need to make a small, easy Webshop for a friend. He is selling 4 music albums.
      What would be the best way to go?
      Is there a sensible solution for a webshop within processwire? 
    • By prestoav
      Hi folks,
      I have a marketplace site built on PW which I'd like to tie to a subscription payment system for those selling. The user accounts currently use specific PW user accounts. I'm looking closely at PayWhirl to manage payments and subscriptions as it looks ideal for subscriptions. Their API seems to work well too from initial testing.
      I wondered if anyone else in this super forum had used PayWhirl and had any advice or tips & tricks?
  • Create New...