diff --git a/admin/class-wc-cdp-admin.php b/admin/class-wc-cdp-admin.php index fd7612e..896724e 100755 --- a/admin/class-wc-cdp-admin.php +++ b/admin/class-wc-cdp-admin.php @@ -100,6 +100,51 @@ class Wc_Cdp_Admin { } + /** + * Adds the plugin's settings page under WooCommerce's Products tab + * + * @since 1.0.0 + */ + public function add_settings_tab( $sections ) + { + $sections['wc-cdp'] = __( 'Combos de produtos', 'wc-cdp' ); + return $sections; + } + + public function display_settings_tab( $settings, $current_section ) + { + if ( $current_section == 'wc-cdp' ) { + $settings_wc_cdp = array(); + + $settings_wc_cdp[] = array( 'name' => __( 'Combos de produtos', 'wc-cdp' ), 'type' => 'title', 'desc' => __( 'As opções a seguir são usadas para configurar os combos de produtos', 'wc-cdp' ), 'id' => 'wcslider' ); + + $settings_wc_cdp[] = array( + 'name' => __( 'Título do popup', 'wc-cdp' ), + 'id' => 'wc_cdp_title', + 'type' => 'text', + ); + + $settings_wc_cdp[] = array( + 'name' => __( 'Descrição do popup', 'wc-cdp' ), + 'id' => 'wc_cdp_description', + 'type' => 'textarea', + 'desc_tip' => __( 'É exibida logo abaixo do título, antes dos produtos do combo', 'wc-cdp' ), + ); + + $settings_wc_cdp[] = array( + 'name' => __( 'Texto do botão', 'wc-cdp' ), + 'id' => 'wc_cdp_add_to_cart_text', + 'type' => 'text', + ); + + $settings_wc_cdp[] = array( 'type' => 'sectionend', 'id' => 'wc-cdp' ); + return $settings_wc_cdp; + + } else { + return $settings; + } + } + /** * Adds bundled products fields to the WooCoommerce metabox * diff --git a/includes/class-wc-cdp.php b/includes/class-wc-cdp.php index 2dec65d..c5d073c 100755 --- a/includes/class-wc-cdp.php +++ b/includes/class-wc-cdp.php @@ -157,6 +157,9 @@ class Wc_Cdp { $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' ); + $this->loader->add_action( 'woocommerce_get_sections_products', $plugin_admin, 'add_settings_tab' ); + $this->loader->add_action( 'woocommerce_get_settings_products', $plugin_admin, 'display_settings_tab', 10, 2 ); + $this->loader->add_action( 'woocommerce_product_options_related', $plugin_admin, 'display_product_fields' ); $this->loader->add_action( 'woocommerce_process_product_meta', $plugin_admin, 'save_product_fields' ); diff --git a/public/css/wc-cdp-public.css b/public/css/wc-cdp-public.css index 2df6af7..3efff6e 100755 --- a/public/css/wc-cdp-public.css +++ b/public/css/wc-cdp-public.css @@ -7,3 +7,55 @@ width: 100%; height: auto; } + +.wc_cdp_modal_title, +.wc_cdp_modal_description, +.wc_cdp_modal_product_title, +.wc_cdp_modal_product_already_on_cart, +.wc_cdp_bundle_amount, +.wc_cdp_bundle_action_row { + text-align: center; +} + +.wc_cdp_modal_product_title { + font-size: 1rem; + margin-top: 0.5rem; +} + +.wc_cdp_modal_product_separator { + text-align: center; + font-size: 2rem; + font-weight: bold; +} + +.wc_cdp_bundle_amount { + margin-bottom: 1rem; +} + +@media (min-width: 768px) { + .wc_cdp_modal_products_row { + display: flex; + flex-direction: row; + flex-wrap: wrap; + align-items: center; + justify-content: center; + margin-left: -15px; + margin-right: -15px; + } + + .wc_cdp_modal_product { + flex: 0 0 25%; + max-width: 25%; + align-self: stretch; + padding-left: 15px; + padding-right: 15px; + } + + .wc_cdp_modal_product_separator { + flex: 0 0 auto; + width: auto; + max-width: 100%; + padding-right: 15px; + padding-left: 15px; + } +} diff --git a/public/partials/product-bundle-modal.php b/public/partials/product-bundle-modal.php index 0948b24..eed3b01 100644 --- a/public/partials/product-bundle-modal.php +++ b/public/partials/product-bundle-modal.php @@ -29,40 +29,37 @@ -

- - Fazer parzinho é mais legal! - +

+

-

- eu ouvi desconto? é só adicionar os itens abaixo e aproveitar o valor promocional! +

+

-
+
$bundle_product) : ?> -
+
get_image(); ?> -
+

get_title(); ?> -

+ cart->generate_cart_id( $bundle_product->get_id() ); if ( WC()->cart->find_product_in_cart( $product_cart_id ) ) : ?> -

+

- (já está na sua cestinha) + -

@@ -75,10 +72,8 @@ -
-

+
+ -

@@ -87,24 +82,28 @@
-
- - - +
+ + + + - - - + + + + + +
-
+
-