Jump to content

Help removing something from my website


Oliverst

Recommended Posts

On 11/17/2020 at 3:47 AM, coxy1983uk said:

Hello, I have had a website built for my window blinds business that has some custom php so that a customer can add width and length (drop size) when ordering products...... the products are window blinds.

I have since set up a new business and have now copied this original website to a new domain for a new business venture that now sells clothing, So i need to remove the width and drop input box from the product pages.

Id like to know how to remove the input fields from my single product php file on the new site. I have attached a screen shot of what id like removing and i have also attached a copy of the php text below th image from the single product php file. Can anyone help or advise what i need to remove from the php code? Thanks Gareth

 

af3e67792607dffe3acc97a5cf315d2e.jpg

 

</script><?php
global $product;
/**
 * The template for displaying product content in the single-product.php template
 *
 * @version     3.0.0
 */

if ( ! defined( 'ABSPATH' ) ) {
    exit;
}

?>

<?php

    /**
     * woocommerce_before_single_product hook.
     *
     * @hooked wc_print_notices - 10
     */


     do_action( 'woocommerce_before_single_product' );

     if ( post_password_required() ) {
        echo get_the_password_form();
        return;
     }

global $porto_layout;

$post_class = join( ' ', get_post_class() );


if ($porto_layout === 'widewidth' || $porto_layout === 'wide-left-sidebar' || $porto_layout === 'wide-right-sidebar') {


    $post_class .= 'm-t-lg m-b-xl';


    if (porto_get_wrapper_type() !=='boxed')


        $post_class .= ' m-r-md m-l-md';


}

?>

<!-- woocommerce_get_product_schema DEPRECATED with NO altertative in 3.0.0 -->
<div itemscope itemtype="<?php //echo woocommerce_get_product_schema(); ?>" id="product-<?php the_ID(); ?>" class="<?php echo $post_class ?>">

    <div class="product-summary-wrap">


        <div class="row">

            <div class="col-md-12 producttop">

                <div class="col-md-6"> 

                    <h2 itemprop="name" class="product_title entry-title"><?php the_title(); ?></h2>

                    <?php $despatch = get_post_meta( $post->ID, 'despatch', true );
                        $rem_spc_despatch = trim($despatch);
                    if ($rem_spc_despatch == null) {
                        ?>
                        <p style="margin: 0;"><i class="porto-icon-shipping"></i> Estimated despatch 3-5 working days.</p>
                    <?php }
                    else{ ?>
                        <p style="margin: 0;"><i class="porto-icon-shipping"></i> <?= $rem_spc_despatch; ?></p>
                    <?php } ?> 

                    <?php 

global $product;

if ( get_option( 'woocommerce_enable_review_rating' ) === 'no' ) {
    return;
}

$rating_count = $product->get_rating_count();
$review_count = $product->get_review_count();
$average = $product->get_average_rating();

if ( $rating_count > 0 ) : ?>

    <div style="margin: 0;" class="woocommerce-product-rating" itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
        <div class="star-rating" title="<?php echo $average ?>">
            <span style="width:<?php echo ( ( $average / 5 ) * 100 ); ?>%">
                <strong itemprop="ratingValue" class="rating"><?php echo esc_html( $average ); ?></strong> <?php printf( __( 'out of %s5%s', 'woocommerce' ), '', '' ); ?>
            </span>
        </div>
        <meta content="<?php echo $rating_count; ?>" itemprop="ratingCount" />
        <meta content="5" itemprop="bestRating" />
        <?php if ( comments_open() ) : ?>
            <div class="review-link"><a href="<?php if (porto_is_ajax()) the_permalink() ?>#reviews" class="article about using a crm system https://www.bloggersideas.com/phonexa-review/" rel="nofollow"><?php printf( _n( '(%s review)', '(%s reviews)', $review_count, 'woocommerce' ), '<span itemprop="reviewCount" class="count">' . $review_count . '</span>' ); ?></a>|<a href="<?php if (porto_is_ajax()) the_permalink() ?>#review_form" class="woocommerce-write-review-link" rel="nofollow"><?php echo __( 'Add a review', 'woocommerce' ); ?></a></div>
        <?php endif; ?>
    </div>

<?php else : ?>

    <?php if ( comments_open() ) : ?>
        <div class="woocommerce-product-rating noreview">
            <a href="<?php if (porto_is_ajax()) the_permalink() ?>#review_form" class="woocommerce-write-review-link" rel="nofollow"><?php echo __( 'There are no reviews yet.', 'woocommerce' ); ?></a>
        </div>
    <?php endif; ?>

<?php endif; ?>


<script type="text/javascript">
    jQuery(function($){
            $('.review-link a').click(function(){
                $('#tab-reviews').show();
            });
        });
</script>

                </div>              
                <div class="col-md-6">

                    <div class="inc-vat"><p>Inc | VAT</p></div>
                    <?php 
                    if( $product->is_type( 'variable' ) ){
                        echo'<div class="prd-price"><span class="frm">From</span>' . wc_price( wc_get_price_including_tax( $product ) ) . '</div>';
                    }else{
                        echo'<div class="prd-price"></div>';
                    }
                    ?>
                      <!--<div class="prd-price"><span class="frm">From</span><?php echo wc_price( wc_get_price_including_tax( $product ) ); ?></div>-->
                    
                </div>
            </div>
            
            <div class="col-md-6 summary-before">

                <?php
                    /**
                     * woocommerce_before_single_product_summary hook.
                     *
                     * @hooked woocommerce_show_product_sale_flash - 10
                     * @hooked woocommerce_show_product_images - 20
                     */
                    do_action( 'woocommerce_before_single_product_summary' );
                ?>


                <div class="share_icon">
                    <ul>
                        <li><?= do_shortcode('[fb_button]'); ?></li>
                        <li><?= do_shortcode('[bws_pinterest_pin_it]'); ?></li>
                        <li><?= do_shortcode('[twitter_buttons display=tweet]'); ?></li>
                    </ul>
                </div>
            </div>

            <div class="col-md-6 summary entry-summary">

         
<?php
$dsb =  get_post_meta($post->ID , 'disablehw' , true);
 $pricearr =  json_decode(get_post_meta($post->ID , 'cus_price' , true) ,true);
if(!empty($pricearr )){

$b = min($pricearr);
}else{

    $b = 0;
}

$term =  get_the_terms( $post->ID, 'product_cat' );
foreach ($term as $t) {
   $parentId = $t->parent;
   if($parentId == 0){
      $t->slug;
   }else{
     $term = get_terms( 'product_cat', array('include' => array($parentId)) );
   }
}
   

     $mystt = array(52,81);
     if ( $product->is_type( 'variable' ) ) {
     
if($dsb != 'on' ){   

    
?>


            <center>

            <div id="val_field">
        <div id="limiteror" style="color: red">*Unfortunately those dimensions are not available</div>
                    <div class="width">
                        <input onkeyup="get_price()" type="text" id="width_val" >
                    </div>

                    <div class="drop">
                        <input onkeyup="get_price()" type="text" id="drop_val" >
                    </div>

                    <div id="w_limit"></div>

                    <div id="d_limit"></div>

            </div> 

   <?php }

   } ?>
            <div id="show_price" style="height: 70px;">
                <h1><span id="mesu_price"></span></h1>
            </div>


            <div id="btn">
                <button type="submit" onclick="get_price()" name="" id="get_price">Get Price</button>
            </div>

            </center>

         <?php 

$terms = get_the_terms ( $product_id, 'product_cat' );
foreach ( $terms as $term ) {
     $cat_id = $term->id;
}

$ccat = $terms[0]->name;
if($ccat == 'Perfect Fit')
{
    ?>
    <script type="text/javascript">
        
        jQuery('#width_val').attr('placeholder' , 'Glass Width');
        jQuery('#drop_val').attr('placeholder' , 'Glass Drop');

    </script>
    <?php
}
else{

    ?>
    <script type="text/javascript">
        
        jQuery('#width_val').attr('placeholder' , 'Width(mm)');
        jQuery('#drop_val').attr('placeholder' , 'Drop(mm)');

    </script>
    <?php
}


if( $product->is_type( 'variable' ) ){


if($b > 0){

          ?>
          <script type="text/javascript">
            jQuery(function(){
                                    jQuery('#limiteror').hide();
            })

    setTimeout(function(){
    jQuery('span.woocommerce-Price-amount.amount').html('<span class="woocommerce-Price-currencySymbol">£</span><?=  number_format($b, 2, '.', '') ?>');
   
    }, 20);
</script>
<?php 
}
}
?>
<script type="text/javascript">
   
    jQuery('#r_mm').trigger('click');
    jQuery('.single_add_to_cart_button').attr('disabled', 'disabled');
    //jQuery('.single_add_sample_to_cart_button').removeAttr('disabled', 'disabled');
    jQuery('#show_price').hide();

    jQuery('table.variations tbody tr td.value select').change(function(){
          jQuery('#get_price').trigger('click');
    });

    function get_price()
    {
     var cwidth = jQuery("#width_val").val();
       var cdrop =  jQuery("#drop_val").val();


           jQuery('#widtth').val(cwidth);
           jQuery('#height').val(cdrop);

       
        

       if(cwidth >= 2401 || cdrop >= 3001)
       {
       
        jQuery('#limiteror').show();
       
        jQuery('.single_add_to_cart_button').attr('disabled', 'disabled');
    

       }
       else{
        jQuery('#limiteror').hide();
        jQuery('.single_add_to_cart_button').removeAttr('disabled', 'disabled');
        setTimeout(function(){ 

      var width =   jQuery("#width_val").val();
        var drop =  jQuery("#drop_val").val();

        var data = {'action':'getcal' , 'width':width , 'drop':drop  , 'postid':'<?=  $post->ID ?>'};
        var ajaxurl = "<?php echo admin_url('admin-ajax.php'); ?>";
        
        jQuery.ajax({
            url: ajaxurl,
            method: 'POST',
            data:data,
  
      
        }).done(function(responce) {
          
      
            jQuery('#show_price').fadeIn();
            jQuery('#mesu_price').html('Your Price: <span>£'+responce+'</span>');
                           
            jQuery('#org_price').val(responce);
        var sprice = 0;
        var ss = jQuery('.woocommerce-variation-price').find('span.woocommerce-Price-amount.amount').text();
        sprice = ss.replace(/\D*/, "");
        if(isNaN(parseFloat(responce))){
        responce = 0;
   }


   if(isNaN(sprice) || sprice == '' ){
    sprice = 0;
   }

   var total = parseFloat(responce) + parseFloat(sprice);


   jQuery('#mesu_price').html('Your Price: <span>£'+total+'</span>');
        jQuery('#final_price').val(total);

    jQuery('.actualprice').html('<span class="woocommerce-Price-amount amount">Total Price: <span class="woocommerce-Price-currencySymbol">£'+total+'</span></span>');
    jQuery('#var_price').val(price);

    jQuery('#mesu_price').html('Your Price: <span>£'+total+'</span>');


   

        });
   
 }, 2000);
    }
    }

    function width_field_key_up()
    {       
        var width = jQuery(this).val();   
    }


    function drop_field_key_up()
    {
          var drop = jQuery(this).val();  
    
    }


    function palce(val){
        
        if(val == "mm"){

        jQuery('#mesu_price').html('');
        
        jQuery('#width_val').val('');
        jQuery('#drop_val').val('');
        jQuery('#final_price').val('');

        jQuery('#w_limit').html('');
        jQuery('#d_limit').html('');

        
        }//MM IF CLOSE
        else if(val == "cm"){
        jQuery('#width_val').attr('placeholder' , 'Width(cm)');
        jQuery('#drop_val').attr('placeholder' , 'Drop(cm)');

        jQuery('#mesu_price').html('');
        
        jQuery('#width_val').val('');
        jQuery('#drop_val').val('');
        jQuery('#final_price').val('');

        jQuery('#w_limit').html('');
        jQuery('#d_limit').html('');


        }//CM IF CLOSE
        else if(val == "inches"){
        jQuery('#width_val').attr('placeholder' , 'Width(inch)');
        jQuery('#drop_val').attr('placeholder' , 'Drop(inch)');

        jQuery('#mesu_price').html('');
        
        jQuery('#width_val').val('');
        jQuery('#drop_val').val('');
        jQuery('#final_price').val('');
        
        jQuery('#w_limit').html('');
        jQuery('#d_limit').html('');

        }//INCH IF CLOSE

    }   
        
                

            </script>            
                
                <?php
                    /**
                     * woocommerce_single_product_summary hook.
                     *
                     * @hooked woocommerce_template_single_title - 5
                     * @hooked woocommerce_template_single_rating - 10
                     * @hooked woocommerce_template_single_price - 10
                     * @hooked woocommerce_template_single_excerpt - 20
                     * @hooked woocommerce_template_single_add_to_cart - 30
                     * @hooked woocommerce_template_single_meta - 40
                     * @hooked woocommerce_template_single_sharing - 50
                     */
                    //$available_variations = $product->get_available_variations();
                    //var_dump( $available_variations );
                   remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );
                   add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 25 );

                    do_action( 'woocommerce_single_product_summary' );


                ?>


            </div>


        </div>


    </div><!-- .summary -->

    <div class="related-product">

        <?php echo do_shortcode('[related_products limit="12"]'); ?>

    </div>
    
    <?php
        /**
         * woocommerce_after_single_product_summary hook.
         *
         * @hooked woocommerce_output_product_data_tabs - 10
         * @hooked woocommerce_upsell_display - 15
         * @hooked woocommerce_output_related_products - 20
         */
        do_action( 'woocommerce_after_single_product_summary' );
    ?>

    <meta itemprop="url" content="<?php the_permalink(); ?>" />

</div><!-- #product-<?php the_ID(); ?> -->

<?php do_action( 'woocommerce_after_single_product' ); ?>


<script type="text/javascript">
    
jQuery(document).ready(function($){

    $( ".variations_form" ).on( "woocommerce_variation_select_change", function () {
   
   test();
    

} );

    jQuery('.single_add_sample_to_cart_button').on("click", function(){

 

    
       

        jQuery('.variations tbody > tr').each(function(i, data) {


            var blindID = jQuery(this).find('select').attr('id');
            var blindOption = jQuery(this).children().find(' select option:eq(1)').val();


            $("#"+blindID ).val(blindOption);
           
        });
       
    });

    

jQuery('.woocommerce-variation-add-to-cart').append('<input type="hidden" name="final_price" id="final_price" value="" />  ');
jQuery('.woocommerce-variation-add-to-cart').append('<input type="hidden" name="org_price" id="org_price" value="" />  ');

jQuery('.woocommerce-variation-add-to-cart').append('<input type="hidden" name="height" id="height" value="" />  ');

jQuery('.woocommerce-variation-add-to-cart').append('<input type="hidden" name="widtth" id="widtth" value="" />  ');
jQuery('.woocommerce-variation-add-to-cart').append(' <input type="hidden" id="var_price" name="var_price"> ');

});
function test(){

 var finalprice = 0;

     setTimeout(function(){
         var ss = jQuery('.woocommerce-variation-price').find('span.woocommerce-Price-amount.amount').text();
    console.log(ss);   
     finalprice =     parseFloat(jQuery('#org_price').val()); 
   price = ss.replace(/\D*/, "");
      if(isNaN(price) || price == '' ){
    price = 0;
   }

   
   if(isNaN(finalprice)){
    finalprice = 0;
   }
   var total = finalprice + parseFloat(price);

    jQuery('.actualprice').html('<span class="woocommerce-Price-amount amount">Total Price: <span class="woocommerce-Price-currencySymbol">£'+total+'</span></span>');
    jQuery('#mesu_price').html('Your Price: <span>£'+total+'</span>');

    
       jQuery('#final_price').val(total);
       jQuery('#var_price').val(price);

},100);
}


// if(jQuery('.type-product').hasClass('product_cat-roofblinds')){

//     jQuery('form.variations_form.cart tr:nth-child(4) .value select').change(function(){
   
//         setTimeout(function(){ 
//             jQuery('.product_cat-roofblinds .woocommerce-variation-price .price .woocommerce-Price-amount').before('Total Price:');
//              alert('ll');}, 3500);

//     });
// }

</script>
<style type="text/css">
    .woocommerce-variation-price {
    display: none;
}
.actualprice {
    text-align: center;
    font-size: 18px;
    margin-bottom: 28px;
    color: #000000;
    font-weight: 200;
}
.actualprice .woocommerce-Price-currencySymbol {
    color: #0088cc;
}
</style>

I have almost the same problem, I have fields that I don't need right now, and I'm tired of going through all the settings in woocommerce and looking for a solution there. Can you please tell me where I can disable or change these settings? Or is it a problem with the website template?

Edited by requinix
thread split
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.