MoIP,para que vender produtos utilizando um carrinho simples. Pela internet Baseado no plugin Simple Paypal Shopping Cart. */ /* This program is free software; you can redistribute it under the terms of the GNU General Public License version 2, as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ load_plugin_textdomain($wp_shopping_cart_um_domain, PLUGINDIR.'/'.$cum_plugin_path.'langs', $cum_plugin_path.'langs'); session_start(); function ps_shopping_cart_show($content) { if (strpos($content, "") !== FALSE) { if (ps_cart_not_empty()) { $content = preg_replace('/
\s*\s*<\/p>/i', "", $content); $matchingText = ''; $replacementText = ps_print_wp_shopping_cart(); $content = str_replace($matchingText, $replacementText, $content); } } return $content; } if ($_POST['addcart']) { $count = 1; $products = $_SESSION['pssimpleCart']; if (is_array($products)) { foreach ($products as $key => $item) { if ($item['name'] == $_POST['product']) { $count += $item['quantity']; $item['quantity']++; unset($products[$key]); array_push($products, $item); } } } else { $products = array(); } if ($count == 1) { if (!empty($_POST[$_POST['product']])) $valor = $_POST[$_POST['product']]; else $valor = $_POST['valor']; $product = array('name' => stripslashes($_POST['product']), 'valor' => $valor, 'quantity' => $count, 'cartLink' => $_POST['cartLink'], 'item_number' => $_POST['item_number']); array_push($products, $product); } sort($products); $_SESSION['pssimpleCart'] = $products; } else if ($_POST['cquantity']) { $products = $_SESSION['pssimpleCart']; foreach ($products as $key => $item) { if (($item['name'] == $_POST['product']) && $_POST['quantity']) { $item['quantity'] = $_POST['quantity']; unset($products[$key]); array_push($products, $item); } else if (($item['name'] == $_POST['product']) && !$_POST['quantity']) unset($products[$key]); } sort($products); $_SESSION['pssimpleCart'] = $products; } else if ($_POST['delcart']) { $products = $_SESSION['pssimpleCart']; foreach ($products as $key => $item) { if ($item['name'] == $_POST['product']) unset($products[$key]); } $_SESSION['pssimpleCart'] = $products; } function ps_print_wp_shopping_cart() { if (!ps_cart_not_empty()) { return; } $email = get_bloginfo('admin_email'); $defaultEmail = get_option('cart_moip_email'); $moip_symbol = 'R$'; $url_images = get_bloginfo('wpurl')."/wp-content/plugins/wordpress-carrinho-moip/images/"; if (!empty($defaultEmail)) $email = $defaultEmail; $decimal = '.'; $urls = ''; $title = get_option('wp_cart_title'); if (empty($title)) $title = 'Suas compras'; $output .= '
| Produto | |||
|---|---|---|---|
| ".ps_print_payment_currency(($item['valor'] * $item['quantity']), $moip_symbol, $decimal)." | |||
| Total: | ".ps_print_payment_currency(($total), $moip_symbol, $decimal)." | ||
| "; $output .= "'; } $output .= " | |||
Para se informar sobre suporte, por favor, visite:
http://www.andrewebmaster.com.br/internet/?p=206
Doar para o Plugin>>
:Forum >>
- Ver ==screenshot== Imagens>>
| E-mail de cadastro MoIP | |
|---|---|
| TÃtulo do carrinho de compras | |
| Texto do botão de adicionar ao carrinho |
'; } function ps_wp_cart_options() { echo '
_e("Configure as opções do plugin no menu de opções."); ?>
'widget_wp_moip_shopping_cart', 'description' => __( "Mostra o carrinho de compras MoIP.") ); wp_register_sidebar_widget('wp_moip_shopping_cart_widgets', __('Carrinho MoIP'), 'show_wp_moip_shopping_cart_widget', $widget_options); wp_register_widget_control('wp_moip_shopping_cart_widgets', __('Carrinho MoIP'), 'wp_moip_shopping_cart_widget_control' ); } function wp_cart_css() { echo ''."\n"; } // Insert the options page to the admin menu add_action('admin_menu','ps_wp_cart_options_page'); add_action('init', 'widget_wp_moip_shopping_cart_init'); add_filter('the_content', 'ps_print_wp_cart_button'); add_filter('the_content', 'ps_shopping_cart_show'); add_action('wp_head', 'wp_cart_css'); ?>