Page 1 of 1

how to hide SKU with VQMOD

Posted: Sun Jun 08, 2014 8:29 am
by gergovprint

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<modification>
   <id><![CDATA[Hidden]]></id>
   <version><![CDATA[1.0.0]]></version>
   <vqmver><![CDATA[2.4.1]]></vqmver>
   <author><![CDATA[bgd]]></author>
   <file name="admin/view/template/catalog/product_form.tpl">
        <operation>
            <search position="replace">
            <![CDATA[<?php echo $entry_sku; ?>]]>
         </search>
            <add>
            <![CDATA[]]>
         </add>
        </operation>
      <operation>
            <search position="replace">
            <![CDATA[<input type="text" name="sku" value="<?php echo $sku; ?>" />]]>
         </search>
            <add>
            <![CDATA[
            <input type="hidden" name="sku" value="<?php echo $sku; ?>" />
            ]]>
         </add>
        </operation>
so make the code work, but remains blank <tr> ></tr>
Can you help me, what should I do

Re: how to hide SKU

Posted: Sun Jun 08, 2014 9:15 am
by labeshops
Instead of hidden, use display: none; as it removes the space as well.

Try

Code: Select all

    <?xml version="1.0" encoding="UTF-8"?>
    <modification>
       <id><![CDATA[Hidden]]></id>
       <version><![CDATA[1.0.0]]></version>
       <vqmver><![CDATA[2.4.1]]></vqmver>
       <author><![CDATA[bgd]]></author>
       <file name="admin/view/template/catalog/product_form.tpl">
            <operation>
                <search position="replace">
                <![CDATA[<?php echo $entry_sku; ?>]]>
             </search>
                <add>
                <![CDATA[]]>
             </add>
            </operation>
          <operation>
                <search position="replace">
                <![CDATA[<input type="text" name="sku" value="<?php echo $sku; ?>" />]]>
             </search>
                <add>
                <![CDATA[
                <input style="display:none;" name="sku" value="<?php echo $sku; ?>" />
                ]]>
             </add>
            </operation>

Re: how to hide SKU

Posted: Sun Jun 08, 2014 9:27 am
by gergovprint
I tried ... your code ... does not work

Re: how to hide SKU

Posted: Sun Jun 08, 2014 8:27 pm
by gergovprint
solve the problem
<file name="admin/view/template/catalog/product_form.tpl">
<operation>
<search position="replace">
<![CDATA[<td><?php echo $entry_sku; ?></td> ]]>
</search>
<add>
<![CDATA[]]>
</add>
</operation>
<operation>
<search position="replace">
<![CDATA[<td><input type="text" name="sku" value="<?php echo $sku; ?>" /></td> ]]>
</search>
<add>
<![CDATA[
<input style="display:none;" name="sku" value="<?php echo $sku; ?>" />
]]>
</add>
</operation>
</file>

But I want to remove and "Subtract Stock:" , "Requires Shipping:", "Tax Class:" , ..................but ... I can not handle it, please help


in folder: admin/view/template/catalog/product_form.tpl"
how can I hide this field in admin panel with VQMOD
I made several attempts, but unfortunately were unsuccessful


Code: Select all

            <tr>
              <td><?php echo $entry_shipping; ?></td>
              <td><?php if ($shipping) { ?>
                <input type="radio" name="shipping" value="1" checked="checked" />
                <?php echo $text_yes; ?>
                <input type="radio" name="shipping" value="0" />
                <?php echo $text_no; ?>
                <?php } else { ?>
                <input type="radio" name="shipping" value="1" />
                <?php echo $text_yes; ?>
                <input type="radio" name="shipping" value="0" checked="checked" />
                <?php echo $text_no; ?>
                <?php } ?></td>
            </tr>
            <tr>

Re: how to hide SKU with VQMOD

Posted: Tue Jun 10, 2014 12:16 am
by Qphoria
First find the "unique" part of the block... something that isn't reproduced anywhere else in the file. For that section you can use:

Code: Select all

<td><?php echo $entry_shipping; ?></td>
Note that "removing" these tags will in turn cause havoc on the php side when those fields are expected by the database calls but not there. So instead you should "hide" these tags by simply adding
style="display:none;" to the parent <tr> tag.

This is slightly trickier to accomplish with just php altering because html is very ambiguous with all the plain <tr> tags out there. So we'll use javascript instead to find the parent by traversing the DOM with jquery. First we need to change the entry <td> to something more unique that jquery can trigger on. This will actually be even better because we can use a class that will match ALL areas you want to hide with a single javascript call.

Code: Select all

<file name="admin/view/template/catalog/product_form.tpl">

	<operation>
		<search position="replace"><![CDATA[
			<td><?php echo $entry_shipping; ?></td>
		]]></search>
		<add trim="false"><![CDATA[
			<td class="hide_my_daddy"><?php echo $entry_shipping; ?></td>
		]]><add>
	</operation>

	<operation>
		<search position="replace"><![CDATA[
			<?php echo $footer; ?>
		]]></search>
		<add trim="false"><![CDATA[
			<script type="text/javascript">$('.hide_my_daddy').parent().hide();</script>
			<?php echo $footer; ?>
		]]><add>
	</operation>

</file>
Add a new operation block to add the class="hide_my_daddy" for each <tr> block you want to hide.

What might be beneficial is if we added negative number support for offset to the vqmod engine, so that you could do

Code: Select all

    <search position="replace" offset="-1">
or some other method like that
But that doesn't exist at the moment.