New Landing How can we help? Themeforest Theme Support Neighborhood [How to] Adding extra description field

Viewing 15 posts - 1 through 15 (of 16 total)
  • #18450
    huntingensemble
    Member
    Post count: 318

    Hi Guys,

    I see alot of people asking how to add an extra description field on a single product page. I know this is a support forum and for advanced php/html customization a developer is indeed the best option. But maybe we can work together and spare some bucks & help each other out.

    I managed to get an extra description field on a single product page by copying the lines in: neighborhood/includes/swift-framework/sf-woocommerce.php (line 253 – 270) and place them on line 271 (so right beneath):

    
    <div class="accordion-group">
    				<div class="accordion-heading">
    					<a href="#product-desc">
    						<?php _e("Description", "swiftframework"); ?>
    					</a>
    		    	</div>
    		    	<div id="product-desc" class="accordion-body collapse in">
    		      		<div class="accordion-inner">
    		      			<?php 
    		      				if ($enable_pb_product_pages) {
    		       					echo do_shortcode($product_description);
    		       				} else {
    		       					the_content();
    		       				}
    		       			?>
    		      		</div>
    		  		</div>
    			</div>
    

    This creates an extra field on the front-end.

    For the back-end:
    Go to neighborhood/includes/swift-framework/meta-boxes.php and on line 734 – 742 copy:

    
    		// PRODUCT DESCRIPTION
    			array(
    				'name' => 'Product Description',
    				'desc' => "You can optionally write a product description here, which shows under the description accordion heading if you have the page builder enabled for product pages.",
    				'id'   => "{$prefix}product_description",
    				'type' => 'textarea',
    				'std'  => "",
    				'cols' => '40',
    				'rows' => '8',
    ),
    

    Place this right beneath on line 744 or so..

    Now you have 2 description fields, with the same content in it, only thing I didn’t manage to find out was how to get the content in the new description field because when I put in some text in the backend I see the same text…

    This is probably because of the lines 261 – 267 in sf-woocommerce.php:

    
    <?php 
    		      				if ($enable_pb_product_pages) {
    		       					echo do_shortcode($product_description);
    		       				} else {
    		       					the_content();
    		       				}
    
    		       			?>
    

    I’m not sure how to get the content from the new description box at the front-end of the product page. If some one has a clue let me know!

    Best
    Joost

    #18738
    laranz – SUPPORT
    Member
    Post count: 3186

    Hi,

    Thanks for the heads. I keep this for other users, if it helps them..

    Thanks,
    laranz.

    #19066
    Melanie – SUPPORT
    Member
    Post count: 11032

    Fantastic guide, thank you!

    #26431
    batmans
    Member
    Post count: 5

    anyone had any luck?

    #26704
    laranz – SUPPORT
    Member
    Post count: 3186

    Hi @batmans,

    Can you create a new thread about your problem?

    Thanks,
    laranz.

    #35010
    imweird
    Member
    Post count: 132

    Somebody was able to make it work? and finish it up?

    #35306
    laranz – SUPPORT
    Member
    Post count: 3186

    Hi @imweird,

    What do you mean, you found any problems in the code?

    Let me know, what you got.

    Thanks,
    laranz.

    #35478
    imweird
    Member
    Post count: 132

    nope. this is the problem.

    Now you have 2 description fields, with the same content in it, only thing I didn’t manage to find out was how to get the content in the new description field because when I put in some text in the backend I see the same text…

    I have followed the suggested method described by the user huntingensemble

    As him, I ended up having another toggle accordion / extra section (a clone of the description toggle) and the relative box for editing it in the front-end in the single product page – but when i write something in it, the description does not appear.

    Something is missing

    #35649
    laranz – SUPPORT
    Member
    Post count: 3186

    Hi,

    You can ask the @huntingensemble about that, He will reply you when he get a reply to this thread, because he is he one who writes the code.

    Thanks,
    laranz.

    #40438
    michaelagwunobi21
    Member
    Post count: 93

    @huntingensemble did you manage to add another box under ‘Product Meta’ for your new description field?

    #40439
    huntingensemble
    Member
    Post count: 318

    @michaelagwunobi21 Hi, no I decided to do something else. I placed the description that is underneath the photo and put it in stead of the acordion slider…

    #40441
    michaelagwunobi21
    Member
    Post count: 93

    @huntingensemble what is your website?

    #41043
    Melanie – SUPPORT
    Member
    Post count: 11032

    If you copied the product description code snippet you’ll have to add another ID for the copied code because if both snippets have the id

    ‘id’ => “{$prefix}product_description”,

    they will clash.

    For example call it

    ‘id’ => “{$prefix}product_description_two”,

    Then in the front end you will add

    echo do_shortcode($product_description_two);

    instead of

    echo do_shortcode($product_description);

    #43192
    michaelagwunobi21
    Member
    Post count: 93
    This reply has been marked as private.
    #43291
    michaelagwunobi21
    Member
    Post count: 93
    This reply has been marked as private.
Viewing 15 posts - 1 through 15 (of 16 total)

You must be logged in and have valid license to reply to this topic.

License required for the following item
Login and Registration Log in · Register