Post by pnair39 » Thu Mar 23, 2017 8:08 am

Need assistance in locating paths and file name of Product Description. Created something simple like this which copies Product Name to Meta Description? However only copies Product Name to Meta Description.

Code: Select all

<file path="admin/view/template/catalog/product_form.tpl">
	<operation>
		<search><![CDATA[
		<?php echo $footer; ?>
		]]></search>
		<add position="before"><![CDATA[
		<script type="text/javascript"><!--
		<?php foreach ($languages as $language) { ?>
		$('#input-name<?php echo $language['language_id']; ?>').on({
			'keydown': function() {
				$('#input-meta-description<?php echo $language['language_id']; ?>').css('border-color', '#F60');
			},
			'keyup': function() {
				$('#input-meta-description<?php echo $language['language_id']; ?>').val($(this).val()).css('border-color', '');
			}
		});
		<?php } ?>
		//--></script>
		]]></add>
	</operation>
    </file>


Any guidance would be helpful .

THANKS in Advance.

User avatar
New member

Posts

Joined
Thu Dec 25, 2014 12:24 pm

Post by Johnathan » Thu Mar 23, 2017 11:40 pm

The product description field is in that same file. The line is this one:

Code: Select all

<textarea name="product_description[<?php echo $language['language_id']; ?>][description]" placeholder="<?php echo $entry_description; ?>" id="input-description<?php echo $language['language_id']; ?>" class="form-control summernote"><?php echo isset($product_description[$language['language_id']]) ? $product_description[$language['language_id']]['description'] : ''; ?></textarea>

Image Image Image Image Image


User avatar
Administrator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by pnair39 » Fri Mar 24, 2017 6:11 am

I tried the following but no success, any suggestions?

Code: Select all

<file path="admin/view/template/catalog/product_form.tpl">
	<operation>
		<search><![CDATA[
		<?php echo $footer; ?>
		]]></search>-*
		<add position="before"><![CDATA[
		<script type="text/javascript"><!--
		<?php foreach ($languages as $language) { ?>
		$('#name=[<?php echo $language['language_id']; ?>').on({
			'keydown': function() {
			
				$('#input-meta-description<?php echo $language['language_id']; ?>').css('border-color', '#F60');
			},
			'keyup': function() {
				$('#input-meta-description<?php echo $language['language_id']; ?>').val($(this).val()).css('border-color', '');
			}
		});
		<?php } ?>
		//--></script>
		]]></add>
	</operation>
    </file>

User avatar
New member

Posts

Joined
Thu Dec 25, 2014 12:24 pm

Post by Johnathan » Fri Mar 24, 2017 10:33 pm

I think the line I gave you was wrong, as is your code. I've fixed it above, but the id for the Description field is:

#input-description<?php echo $language['language_id']; ?>

You'd need to make the .val() set the value on that field, not the #input-meta-description field. Your id selector is also wrong, so you should read more about jQuery and CSS selectors to make sure you understand them.

However, keep in mind that the Description field uses the Summernote editor, so it will probably need further javascript customizations to get it working. You're likely going to have to hire someone to do this for you, since I'm not sure someone will provide a complicated edit like that for you for free.

If you need to find a developer, you should post a request in the OpenCart "Commercial Support" forum, which is checked by a number of OpenCart developers. You can also try checking out the OpenCart "Partners" area.

Image Image Image Image Image


User avatar
Administrator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by pnair39 » Tue Mar 28, 2017 9:13 am

Okay Thanks.

User avatar
New member

Posts

Joined
Thu Dec 25, 2014 12:24 pm
Who is online

Users browsing this forum: No registered users and 4 guests