0

Is there are a (safe) way to delete the demonstration Product Types in Commerce Kickstart 2 without the entire Drupal install?

It appears that the Commerce Kickstart 'Reset' function simply empties the entire db. (yikes).

I've read many discussions on this but they tend to go back to 2011. I was hoping there was a more current (and hopeful) answer. We want to get rid of all the 'Drinks', 'Tops', etc. but keep the Products/Types and other content we've created.

2 Answers 2

1

hmm my understanding was that Kickstarter kit was a "hey see what it can do once fully configured!" example of Commerce. Understanding the setup -- you could then go back and install/configure Commerce by hands to your needs.

That being said Commerce content I think is just Entities and Nodes, If you want an non-SQL way to reset a site (i've written ~34 sql Delete statements to nuke content from sites in an sql script for drupal -- it's not that hard you just look at node and field_* tables mostly when clearing content from a drupal site) I'd recommend looking at the Delete All module and the documentation found in drush help delete-all as a GUI means of selecting out types of content to nuke from a drupal site.

EDIT: DrupalCamp Montreal 2014 steps to setting up Commerce ala Commerce Kickstart but Not Depending on the Kickstarter kit

Original source (broken): http://renaudjoubert.com/en/article/step-step-guide-to-installing-commerce-scratch

Step by step guide to installing Commerce from scratch

The following guide was used in a presentation at DrupalCamp Montreal 2014.
The presentation focused on how to install Drupal Commerce from scratch
(i.e. we won't use the Commerce Kickstart distribution).
This is an elevator guide. So get in now because we're going up!

FIRST FLOOR
https://www.drupal.org/project/commerce
Install required modules
drush dl ctools views entity rules addressfield commerce
drush en ctools views entity rules addressfield commerce -y
Installation instructions
https://www.drupal.org/node/1007434
use the provided drush commands
drush en commerce commerce_ui -y
drush en commerce_customer commerce_customer_ui -y
drush en commerce_price -y
drush en commerce_line_item commerce_line_item_ui -y
drush en commerce_order commerce_order_ui -y
drush en commerce_checkout commerce_payment commerce_product -y
drush en commerce_cart commerce_product_pricing -y
drush en commerce_product_ui -y
drush en commerce_tax_ui -y
Add a few more useful modules
drush dl admin_menu module_filter zurb-foundation-7.x-4.x-dev jquery_update -y
drush pm-disable toolbar
drush en admin_menu_toolbar module_filter jquery_update -y
Create a responsive Zurb subtheme
drush fst Your Subtheme Name your_subtheme_name 'A subtheme of ZURB Foundation.'
Set jQuery update to 1.7+ (admin/config/development/jquery_update)
Enable your new responsive subtheme (admin/appearance)

SECOND FLOOR
Quick tour of what we've got soo far
1 Product type named 'Product'
2 tax types
LOTS of hidden functionnalities
NO visible products
and NO, you don't get a store out-of-the-box
Commerce Kickstart gives you that but you won't know how to get there if you don't try from scratch
Create a new product type 'Download'
add file & image fields
Revisit 'Product', the product type installed by Commerce
add an image field
Let's create products
a physical product (Product)
a virtual product (Download)
Now what? where's the store?
Gotcha!

THIRD FLOOR
Out-of-the-box Store is for wimps! ; )
Commerce products only exist in the backstore
products are like brown boxes in a warehouse: they're only accessible to the store's employees
in order to make products accessible to customers, you need to put them on display in a nice and attractive way
how do we do that in Drupal?
we use content types, of course
Create a content type for displaying products
how does Commerce differentiate & recognize product displays from regular content types?
a product reference field!
create product displays and configure them
Alright, let's shop!
wait a minute, nothing happens when i click Add to cart!
Gotcha!

FOURTH FLOOR
In case you didn't read the fine print: some assembly is required, like Ikea, but without the KISS diagrams
Introducing Rules... doh! where's the UI ?
drush en rules_admin -y
go to admin/config/workflow/rules and add a rule that redirects to the cart
Welcome to the cart
Time to checkout wouldn't you say ?
doh!... something isn't right
where are the taxes?
Like I said, Out-of-the-box taxes are for wimps! ; )
Commerce's taxe model is simple
there are tax types; like there are product types and content types
and then there are tax rates which you create using one of the available tax types
Create GST & PST tax rates (note - these taxes are specific to the Province of Quebec in Canada where the camp was held)
Revisit the checkout
Darn, the taxes are not displayed in the expected order! (i.e. GST on this first row, PST on the second row)
How do we change the order in which taxes are displayed ?
the hard way: by overriding theme_commerce_price_formatted_components() in the theme's template.php (see https://drupal.org/node/1095576#comment-8721217)
the easy way: by creating separate tax types for GST and PST and playing with their respective weight (note that at the time of this writing, the behaviour for tax weights does not follow the convention where lighter weights float to the top; see this issue)
Are we in business yet? Not quite.

FITH FLOOR
Setting up a payment method
for simple tests, use the 'Example payment' module (provided by Commerce)
For serious tests and real sales, you can use Stripe or Paypal or whatever works for you. For the purpose of this presentation,I used Stripe.
www.stripe.com
setup an account
get the API keys (secret and publishable)
Install & configure Stripe
drush dl commerce_stripe
drush en commerce_stripe -y
add both keys to the Stripe payment method rule (admin/commerce/config/payment-methods/manage/commerce_payment_commerce_stripe)
Time for some tests
for this, we use the dummy credit cards provided by Stripe
https://stripe.com/docs/testing
When you're happy that all works like it should you can replace de test API keys by the live API keys.
Done!
6
  • I'm actually about 100% more comfortable with SQL statements if there is a -reasonably- safe way to do this. Please advise. And thanks! The other attempts I've read about -seem- to work, but then there is always a follow-up post of 'gotchas' that don't show up immediately.
    – jchwebdev
    Commented Oct 9, 2014 at 21:26
  • BTW: this may just be -me- being 'old', but I (and my co-workers) find this 'no way to delete demo data' approach unbelievable. We (literally) could not imagine that in 2014 that would be the case. We just assumed that this basic nicety would be in place.
    – jchwebdev
    Commented Oct 9, 2014 at 21:28
  • to answer your first question for the clearing of tables via SQL. For the site I built uses community modules, I simply inventory the table structures and hand write the Delete statements as needed. Eg, I'm the developer -- I should understand the schema. For your second question there is no flag that denotes the content as dummy data you seem to be assuming that all users will be inserting their own content and running with the kickstarter setup and wanting to clean it out as you are -- that's not strictly true. Your free to submit patches to add the functionality of course :)
    – tenken
    Commented Oct 9, 2014 at 22:28
  • see webcache.googleusercontent.com/… the site has since moved and the old url i have is broken.
    – tenken
    Commented Oct 9, 2014 at 22:29
  • You may want to follow the above steps (tweaked to your needs) and node_export/uuid module(s) to migrate your existing kickstart site content to a kickstart free Commerce installation. Just a thought.
    – tenken
    Commented Oct 9, 2014 at 22:37
1

This worked for me:

drush dis commerce_kickstart_product -y
drush vset commerce_kickstart_demo_store 0 
drush en commerce_kickstart_lite_product -y

This seemed to allow one to delete the demo product types and such. Not sure if they are regenerated later or not.

5
  • This was so long ago (Thank God!) I've forgotten the details. They will be regenerated later. It's in the Commerce Kickstart Feature.
    – jchwebdev
    Commented Oct 9, 2015 at 18:51
  • I've been working with a setup where I did the above. It's been a month now of cleared caches, registry rebuilds, cron runs, etc. and they still haven't regenerated. When I look in Features, I don't even see the Commerce Kickstart Product feature anymore. It appears to be replaced with Commerce Kickstart Lite Product feature automatically by having done the above. Commented Nov 3, 2015 at 19:00
  • The items enabled/disabled above ARE the Features and the Commerce Kickstart Lite Product feature won't regenerate the sample store content since it's the same Feature that is enabled at install if you elect NOT to install the sample store content. Commented Nov 3, 2015 at 19:02
  • there's a whole series by the code karate guys which covers this.
    – nizz0k
    Commented Dec 6, 2015 at 12:46
  • 1
    For deleting basic content types drush dis commerce_kickstart_product -y should be enough. Then just remove them from content types page. Other commands will also change views and some other predefined settings what you might want to avoid. Commented Nov 16, 2016 at 11:23

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.