Posts Tagged WP e-Commerce

Meet WP e-Commerce Product Showroom Plugin – a custom list of products

I’m proud to present you my new WordPress plugin. It’s “WP e-Commerce Product Showroom“, a product list that you can customize through a widget on wp-admin and fit to your layout needs using a little bit of css.
Estou orgulhoso em apresentar a vocês meu novo plugin WordPress. É o “WP e-Commerce Product Showroom”, uma lista de produtos que você pode customizar através de um widget no wp-admin e adequar às suas necessidades de layout com um pouco de css.

If you are working with “WP e-Commerce”, all you have to do to is to follow the next simple steps:
Se você está trabalhando com “WP e-Commerce”, tudo que você deve fazer é seguir os próximos passos simples:

1. Upload wp_e_showrp folder to the /wp-content/plugins/ directory
Subir a pasta wp_e_showrp para o diretório /wp-content/plugins/
2. Activate the plugin through the ‘Plugins’ menu in WordPress
Ativar o plugin através do menu ‘Plugins’ no WordPress.
3. Register a widget sidebar on your functions file, for example, just paste the code bellow on your theme functions.php
Registrar um sidebar widget no seu arquivo functions, por exemplo cole o código abaixo no functions.php de seu tema.

<if ( function_exists('register_sidebar') ) register_sidebar(array( 'name' => 'wp_e_showrp', 'before_widget' => '', 'after_widget' => '', 'before_title' => '', 'after_title' => '', ));>

Or

You if you have already registered any sidebar, you can drag the WP e-Commerce Product Showroom widget inside it, at wp-admin
Ou, se você já tem uma sidebar registrada, você pode arrastar o widget WP e-Commerce Product Showroom para dentro dela, no wp-admin.
1. Configure the widget on your wp-admin pannel and save
Configure o widget no seu painel wp-admin e salve.
2. Use the PHP code bellow where you want the widget to show, on your theme pages
Use o código PHP abaixo onde você quer que o widget apareça, nas páginas de seu tema

<if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('wp_e_showrp')) : endif;>

Now, the best part… 😉
Agora a melhor parte… 😉

As the result div uses a css class(showrpdiv), you can play with it and make the product list look like you want. Check the example bellow. If you put this on the same page you call the plugin, the list will change as you wish.
Como o div de resultado usa uma classe css(showrpdiv), você pode brincar com ela e fazer a lista de produtos aparecer como você quiser. Se você colocar um código como o abaixo na mesma página onde chama o plugin, a lista vai mudar como você desejar.

.showrpdiv{ float:left; } 
.showrpdiv ul a{ color:red; } 
.showrpdiv li{list-style: none;}

I hope you find it useful and helpful on your WordPress e-commerce projects.
Espero que você ache útil e que possa lhe ajudar em seus projetos de e-commerce com WordPress.

, ,

4 Comments

WP e-Commerce List Products and Images Hack

Important note: It works only for WP-ecommerce 3.6. For later versions, WP-ecommerce database has changed, so you will need the new hack.

You should also take a look on my WP e-Commerce Product Showroom Plugin, a configurable widget and a evolution of the code bellow.

If you are working with WP e-Commerce Plugin, with the code bellow, you will be able to get a kind of product list, with images, anywhere you want on your site.

Just change your database information, and the LIMIT on mysqlquery, and no more stress…

Good look, may the force be with you.

<?
   $conn = mysql_connect("SERVER", "USER", "PASS"); 
    mysql_select_db("DATABASE") or die ("Could not select database" . mysql_error());
    // if you are note sure about the value of $wp_table_prefix, perform a search for this
    // text on your site, the usual value is "wp_" or something
    $sql = "SELECT products.id,products.name,products.description,products.image,product_category.category_id ";
    $sql .= "FROM ".$wp_table_prefix."wpsc_product_list AS products ";
    $sql .= "LEFT JOIN ".$wp_table_prefix."wpsc_item_category_assoc AS product_category ON ";
    $sql .= "products.id=product_category.product_id ";
    $sql .= "WHERE products.publish=1 AND products.active=1 ORDER BY products.name LIMIT 3";
    $qry = mysql_query($sql);
    $nrt = mysql_num_rows($qry);
    while($rs = mysql_fetch_array($qry)):          
?>
                <div>
                    <ul>
                        <li><a href="<?php echo wpsc_product_url($rs[0]); ?>">
                        <img src="index.php?image_id={<?=$rs[3]?>}"></a>
                        <a href="<?php echo wpsc_product_url($rs[0]); ?>"><?=$rs[1];?></a></li>   
                        <li><?=calculate_product_price($rs[0]);?></li>                   
                               
                    </ul>                    
                </div>
<?
	endwhile;     
?>

,

7 Comments

%d bloggers like this: