Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Easy populate


zrxRaver

Recommended Posts

I could not find a solution for missing products_model so I made some simple code for it.

 

In easypopulate.php

 

after this code

echo "Added $linecount records and closing file...<br><br> ";
fclose($fp);
fclose($infp);
echo "You can download your split files in the Tools/Files under /catalog/temp/";
}

 

put this

// create unique temporarily products_model identifier from prefix '__' + products_id
if($create_pmodels==1){
  tep_db_query( "update " . TABLE_PRODUCTS . " p set p.products_model = CONCAT('__', p.products_id) where p.products_model = ''");
}

if($delete_pmodels==1){
  tep_db_query( "update " . TABLE_PRODUCTS . " p set p.products_model = '' where instr(p.products_model, '__') = 1");
}

 

after this

<INPUT TYPE="text" name="localfile" size="50">
			 <input type="submit" name="buttoninsert" value="Insert into db">
			 <br>
		   </p>
		 </div>

		</form>

 

put this

<table>
<tr>
<td colspan="2">
	  <FORM ENCTYPE="multipart/form-data" ACTION="easypopulate.php?create_pmodels=1" METHOD=POST>
		 <p>
		   <div align = "left">
		   <p><b>Temporarily Products_model</b></p>
		   <input type="submit" name="Create" value="Create">
		 </div>
		</form>
  </td>
  <td valign="bottom">
	  <FORM ENCTYPE="multipart/form-data" ACTION="easypopulate.php?delete_pmodels=1" METHOD=POST>
		   <input type="submit" name="Delete" value="Delete">
		 </div>
		</form>
 </td>
  </tr>
  </table>

 

 

Now you have 2 extra buttons, Create and Delete.

Before you make the csv file press Create, all missing products_model will be filled with a unique number made of 2 underscore's and the products_id.

When you're done uploading, press the Delete button, all the temporarily products_model will be deleted, but only those with the double underscore prefix, so all your original products_model will be spared.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...