Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Auto assign product category

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 08-19-2005, 03:37 PM
 
delphighse delphighse is offline
 

Member
  
Join Date: Jan 2003
Location: Washington State USA
Posts: 20
 

Default 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
Reply With Quote
  #2  
Old 08-20-2005, 11:10 AM
 
delphighse delphighse is offline
 

Member
  
Join Date: Jan 2003
Location: Washington State USA
Posts: 20
 

Default

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
Reply With Quote
  #3  
Old 08-20-2005, 01:22 PM
 
delphighse delphighse is offline
 

Member
  
Join Date: Jan 2003
Location: Washington State USA
Posts: 20
 

Default

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
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 06:41 AM.

   

 
X-Cart forums © 2001-2020