I'm building an ecommerce site with Cartthrob where I need to produce a feature for the home page which lists the top 20 sales. This would be simple enough but the client wants to be able to override this and bump up other tracks on the top sellers board from time to time.

With this in mind instead of simply outputting the top 20 sellers at the template level with a simple database query I now have to pull them into the control panel to allow for doctoring before displaying them in the templates.

Can anyone suggest the best way to go about this?

2 Answers 2


Side-stepping the obviously-unethical practice of lying to customers about what is indeed a "top-seller" (maybe consider renaming this list "hot tracks" or something less deceitful?) ...

To avoid having to build a module and control panel for it, I'd use something like Low Variables with a Matrix field, allow your client to select a "sales position" (first column) and a product (channel entry selection - second column) for each row.

Then, in a simple plugin you can query the top sales from CartThrob, then query the data saved by that variable (in the exp_matrix_data table) and bump any actual sales positions out of their place with you fraudulent sales data if need be.

  • Hey Derek, tell me about it. I've had many discussions trying to argue the ethical case but at the end of the day if the client insists then I just have to give him what he wants even if it pains me to do so. :P Thanks for the suggestion though, that sounds interesting and potentially workable. It's still a bit of work but I'll give that a try. Thanks.
    – Ian Young
    Commented Mar 25, 2013 at 20:17
  • I'm hopeful of swaying him to just call it 'Top 20' rather than 'Top 20 Sellers' so at least then it implies nothing specific.
    – Ian Young
    Commented Mar 25, 2013 at 20:26

You could use Low Variables with a Playa field. Let the client choose a list of X products. Add some other variable like a checkbox to switch the automated list or theirs.

Downside is you need to buy extra add-ons ...

Oh, also NSM Entry Select could help. Which is free. Same basic setup, create a custom field type which allows the client to pick entries from the products channel. You'd need to put these fields somewhere though, Low Variables would be a good help.

-- Or what Derek said ;)

  • Thanks for the suggestion. Annoyingly the client wants it the most awkward way possible and the top 20 compiled automatically with 'genuine' results with him having the ability to doctor any of those entries. He doesn't want an either/or so that's what makes it tricky. Buying those addons isn't a problem and I anticipate using Low Variables and Playa anyway but I don't think that will work in this case. Derek's solution may provide that functionality but does require an extra plugin as expected.
    – Ian Young
    Commented Mar 25, 2013 at 20:24
  • Ah I'm sorry I did not read that correctly. Then my sollution is not gonna cut it. Clients, huh ... good luck good sir!
    – Sjoerd
    Commented Mar 26, 2013 at 7:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.