Skip to content

Commit

Permalink
Addressing #19, #20
Browse files Browse the repository at this point in the history
  • Loading branch information
shramee committed Jan 3, 2017
1 parent a2ec881 commit 0b1faed
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 5 deletions.
17 changes: 17 additions & 0 deletions assets/front-end.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,23 @@
.single-product .ppb-product.product {
overflow: visible;
}

/* Center cart *
.single-product div.product .woobuilder-module form.cart {
text-align: center;
}
.single-product div.product .woobuilder-module form.cart .quantity,
.single-product div.product .woobuilder-module form.cart input {
float: none;
display: inline-block
}
.single-product div.product .woobuilder-module form.cart .button {
float: none;
margin-left: 2em;
}
*/
/*
.woobuilder-module:after {
display: block;
Expand Down
3 changes: 2 additions & 1 deletion inc/class-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,17 @@ public function save_post( $post_id ) {
return;
}
update_post_meta( $post_id, 'woobuilder', filter_input( INPUT_POST, 'woobuilder' ) );
update_post_meta( $post_id, 'woobuilder_used_builder', 1 );
}

/**
* Adds admin only actions
* @action admin_init
*/
public function product_meta_fields() {
if ( 'product' !== get_post_type() ) { return; }
// Add an nonce field so we can check for it later.
wp_nonce_field( 'woobuilder-meta', 'woobuilder-nonce' );

?>
<div class="clear misc-pub-section">
<label for="woobuilder"><b><?php _e( 'Enable Product builder', $this->token ); ?></b></label>
Expand Down
14 changes: 10 additions & 4 deletions inc/class-public.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,14 @@ private function __construct() {
public function wc_get_template_part( $template, $slug, $name ) {
if (
'content' == $slug &&
'single-product' == $name &&
WooBuilder::is_ppb_product()
'single-product' == $name
) {
$template = dirname( __FILE__ ) . '/ppb-product-tpl.php';
if ( WooBuilder::is_ppb_product() ) {
$template = dirname( __FILE__ ) . '/ppb-product-tpl.php';
} else if ( get_post_meta( get_the_ID(), 'woobuilder_used_builder', 'single' ) ) {
remove_filter( 'the_content', array( $GLOBALS['Pootle_Page_Builder_Render_Layout'], 'content_filter' ) );
}
}

return $template;
}

Expand Down Expand Up @@ -256,4 +258,8 @@ public function process_shortcode( $data ) {
<?php
}
}

public function init() {

}
}
2 changes: 2 additions & 0 deletions ppb-product-builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ private function _public() {
//Instantiating public class
$this->public = WooBuilder_Public::instance();

$this->public->init();

add_filter( 'wc_get_template_part', array( $this->public, 'wc_get_template_part' ), 10, 3 );
add_action( 'pootlepb_live_editor_init', function () {
$this->public->set_ppb_product_builder_meta( null, get_the_ID(), get_post_type() );
Expand Down

0 comments on commit 0b1faed

Please sign in to comment.