| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
Auto assign product category | |||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
Auto assign product category
Can anyone help me figure this out? When a provider creates a new product I am trying to automatically assign Category 2 with the $login of that provider. I know it is in the product_modify.tpl. I would just like to know how to assign a value that will be written to the products_categoryid1 when the new product is created.
I have been working with this section of the product_modify.tpl and have tried everything I know but I just can't figure it out. <TR> <TD class="TableCenterProductDetails">{$lng.lbl_catego ry2}</TD> <TD class="TableCenterProductDetails"> <SELECT name="categoryid1"> <OPTION value=0 {if $product.categoryid1 eq "0"}selected{/if}>{$lng.lbl_undefined}</OPTION> {section name=cat_num loop=$allcategories} <option value="{$allcategories[cat_num].categoryid}" {if $allcategories[cat_num].categoryid eq $product.categoryid1}selected{/if}>{ $allcategories[cat_num].category }</option> {/section} </SELECT></TD> </TR> If anyone can help me I would be so very grateful. Thanks very much. Becky Xcart V. 3.2.4 |
|||||||
#2
|
|||||||
|
|||||||
I am attempting to assign the category 2 of a product automatically and I have changed product_modify.tpl from this:
<TR> <TD class="TableCenterProductDetails">{$lng.lbl_catego ry2}</TD> <TD class="TableCenterProductDetails"> <SELECT name="categoryid1"> <OPTION value=0 {if $product.categoryid1 eq "0"}selected{/if}>{$lng.lbl_undefined}</OPTION> {section name=cat_num loop=$allcategories} <option value="{$allcategories[cat_num].categoryid}" {if $allcategories[cat_num].categoryid eq $product.categoryid1}selected{/if}>{ $allcategories[cat_num].category }</option> {/section} </SELECT></TD> </TR> To This: {assign var="categoryid1" value="Vendors/$login "} {section name=cat_num loop=$allcategories} {if $categoryid1 eq $allcategories[cat_num].category} {assign var="product.categoryid1" value="$allcategories[cat_num].categoryid"} {else} {$categoryid1|count_characters:true} {$allcategories[cat_num].category|count_characters:true} {$allcategories[cat_num].category}{$categoryid1} {/if} {/section} The problem I am having is that the variable $categoryid1 is not eq to the $allcategories[cat_num].category. In the else statement I am verifying that the character count is the same as well as the value. When I run this I can verify that there is a match but the compare is turning up false. What am I doing wrong? Any help would be very much appreciated. It's probably something very simple, but I have spend days on this and can't seem to come up with the answer. Thanks very much. Becky xcart V3.2.4 |
|||||||
#3
|
|||||||
|
|||||||
Well, I think I may be getting close to a solution for my problem.
{assign var="categoryassign" value=" Vendors/$login"} {section name=cat_num loop=$allcategories} {if $categoryassign eq $allcategories[cat_num].category} {assign var="categoryid1" value=$allcategories[cat_num].categoryid} {/if} {/section} This works very well with the categoryid1$ assigned with the automatic category, but it does not store in the database. I assume it is not being passed to the include/product_modify.php. How can I get the value back to the php? Thanks for your help. Becky xcart v 3.2.4 |
|||||||
|
|||
X-Cart forums © 2001-2020
|