Changeset 1917009
- Timestamp:
- 07/30/2018 05:37:04 PM (8 years ago)
- Location:
- woo-oscommerce-sync/trunk
- Files:
-
- 2 edited
-
readme.txt (modified) (2 diffs)
-
woocommerce-osc-sync.php (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
woo-oscommerce-sync/trunk/readme.txt
r1914783 r1917009 5 5 Requires at least: 3.5.1 6 6 Tested up to: 4.9.4–es_ES 7 Stable tag: 2.0. 67 Stable tag: 2.0.7 8 8 License: AGPLv3.0 or later 9 9 License URI: http://opensource.org/licenses/AGPL-3.0 … … 70 70 71 71 == Changelog == 72 = 2.0.7 = 73 * Include Bootstrap tabs and forms 74 72 75 = 2.0.6 = 73 76 * Include products weight -
woo-oscommerce-sync/trunk/woocommerce-osc-sync.php
r1914783 r1917009 5 5 Description: Import products, categories, customers and orders from osCommerce to Woocommerce 6 6 Author: Alejandro Aranda 7 Version: 2.0. 67 Version: 2.0.7 8 8 Author URI: http://www.aaranda.es 9 9 Original Author: David Barnes … … 115 115 $url = rtrim($_POST['store_url'], '/') . '/image/' . urlencode($category['categories_image']); 116 116 } 117 otw_log("importCategories", "Image: " . $url);117 otw_log("importCategories", "Image: " . $url); 118 118 $attach_id = otw_import_image($url); 119 119 } … … 126 126 $import_cat_counter ++; 127 127 } else { 128 otw_log("importCategories", "Edit Categorie: " .$term['term_id'] .".-." . json_encode($category));129 128 otw_log("importCategories", "Edit Categorie: " . $term['term_id'] . ".-." . json_encode($category)); 129 130 130 delete_option('product_cat_children'); // clear the cache 131 131 … … 140 140 $url = rtrim($_POST['store_url'], '/') . '/image/' . urlencode($category['categories_image']); 141 141 } 142 otw_log("importCategories", "Image: " .$url);142 otw_log("importCategories", "Image: " . $url); 143 143 $attach_id = otw_import_image($url); 144 144 } … … 175 175 if ($oscdb->ready) { 176 176 ob_start(); 177 // echo '< p>Starting...<em>(If the page stops loading or shows a timeout error, then just refresh the page and the importer will continue where it left off. If you are using a shared server and are importing a lot of products you may need to refresh several times)</p>';177 // echo '<div class="form-group">Starting...<em>(If the page stops loading or shows a timeout error, then just refresh the page and the importer will continue where it left off. If you are using a shared server and are importing a lot of products you may need to refresh several times)</div>'; 178 178 // Do customer import 179 179 … … 290 290 //Import the taxes 291 291 if ($taxes = $oscdb->get_results($sql, ARRAY_A)) { 292 otw_log("importtaxes", " taxes origin total: " . count($taxes));292 otw_log("importtaxes", " taxes origin total: " . count($taxes)); 293 293 foreach ($taxes as $tax) { 294 otw_log("importtaxes", json_encode($tax));295 294 otw_log("importtaxes", json_encode($tax)); 295 296 296 $sql = " 297 "; 298 $import_tax_counter++;297 "; 298 $import_tax_counter++; 299 299 } 300 300 } 301 301 302 302 otw_log("importtaxes", "End Import"); 303 303 } … … 577 577 if (!empty($_POST['images_url'])) { 578 578 $url = rtrim($_POST['store_url'], '/') . '/' . rtrim($_POST['images_url'], '/') . '/' . ($product['image']); 579 } else { 579 } else { 580 580 $url = rtrim($_POST['store_url'], '/') . '/images/' . ($product['image']); 581 581 } … … 762 762 } 763 763 } else { 764 echo '<p class="notice">The information (pages) table does not exist in this osCommerce installation.</ p>';764 echo '<p class="notice">The information (pages) table does not exist in this osCommerce installation.</div>'; 765 765 } 766 766 } … … 769 769 $success = true; 770 770 } else { 771 echo '<p class="notice">Could not connect to the osCommerce database</ p>';771 echo '<p class="notice">Could not connect to the osCommerce database</div>'; 772 772 } 773 773 } 774 774 ?> 775 <form method="post" action="" >775 <form method="post" action="" style="margin: 10px 15px;"> 776 776 777 777 <?php … … 785 785 <?php 786 786 if ((int) $_POST['dtype']['customers'] == 1) { 787 echo '< p>Customers Imported: ' . $import_customer_counter . '</p>';787 echo '<div class="form-group">Customers Imported: ' . $import_customer_counter . '</div>'; 788 788 } 789 789 if ((int) $_POST['dtype']['orders'] == 1) { 790 echo '< p>Orders Imported: ' . $order_import_counter . '</p>';790 echo '<div class="form-group">Orders Imported: ' . $order_import_counter . '</div>'; 791 791 } 792 792 if ((int) $_POST['dtype']['categories'] == 1) { 793 echo '< p>Categories Imported: ' . $import_cat_counter . '</p>';793 echo '<div class="form-group">Categories Imported: ' . $import_cat_counter . '</div>'; 794 794 } 795 795 if ((int) $_POST['dtype']['taxes'] == 1) { 796 echo '< p>Taxes Imported: ' . $import_tax_counter . '</p>';796 echo '<div class="form-group">Taxes Imported: ' . $import_tax_counter . '</div>'; 797 797 } 798 798 if ((int) $_POST['dtype']['products'] == 1) { 799 echo '< p>Products Imported: ' . $import_prod_counter . '</p>';799 echo '<div class="form-group">Products Imported: ' . $import_prod_counter . '</div>'; 800 800 } 801 801 if ((int) $_POST['dtype']['image'] == 1) { 802 echo '< p>Images Imported: ' . $import_img_counter . '</p>';802 echo '<div class="form-group">Images Imported: ' . $import_img_counter . '</div>'; 803 803 } 804 804 if ((int) $_POST['dtype']['gallery'] == 1) { 805 echo '< p>Images gallery Imported: ' . $import_gallery_counter . '</p>';805 echo '<div class="form-group">Images gallery Imported: ' . $import_gallery_counter . '</div>'; 806 806 } 807 807 if ((int) $_POST['dtype']['pages'] == 1) { 808 echo '< p>Pages Imported: ' . $page_import_counter . '</p>';808 echo '<div class="form-group">Pages Imported: ' . $page_import_counter . '</div>'; 809 809 } 810 810 ?> … … 815 815 } 816 816 ?> 817 <div class="row"> 818 <div class="col-md-6 form-control" style="background-color: #f1f1f1"> 817 <ul class="nav nav-tabs" id="myTab" role="tablist"> 818 <li class="nav-item"> 819 <a class="nav-link active" id="home-tab" data-toggle="tab" href="#home" role="tab" aria-controls="home" aria-selected="true">OsCommerce Database Conection</a> 820 </li> 821 <li class="nav-item"> 822 <a class="nav-link" id="profile-tab" data-toggle="tab" href="#profile" role="tab" aria-controls="profile" aria-selected="false">Products Configuration</a> 823 </li> 824 <li class="nav-item"> 825 <a class="nav-link" id="contact-tab" data-toggle="tab" href="#contact" role="tab" aria-controls="contact" aria-selected="false">Select Imports</a> 826 </li> 827 </ul> 828 <div class="tab-content" id="myTabContent"> 829 <div class="tab-pane fade show active modal-body bg-light" id="home" role="tabpanel" aria-labelledby="home-tab"> 830 <h4>Enter your oscommerce database information </h4> 831 <div class="alert alert-warning" role="alert"> 832 You will need remote access to your oscommerce database 833 </div> 834 <div class="row"> 835 <div class="col-md-6"> 836 <div class="form-group"> 837 <label >osCommerce store URL: </label> 838 <input class="form-control" type="text" name="store_url" value="<?php echo sanitize_text_field($_POST['store_url']); ?>"> 839 <small>Example: https://www.[your site].com/</small> 840 </label> 841 </div> 842 <div class="form-group"><label >osCommerce Database Host: </label><input class="form-control" type="text" name="store_host" value="localhost"></div> 843 <div class="form-group"><label >osCommerce Database Name: </label><input class="form-control" type="text" name="store_dbname" value="<?php echo sanitize_text_field($_POST['store_dbname']); ?>"></div> 844 </div> 845 <div class="col-md-6"> 846 <div class="form-group"> 847 <label >Images directory: </label> 848 <input class="form-control" type="text" name="images_url" value="<?php echo sanitize_text_field($_POST['images_url']); ?>"> 849 <small>Empty directory as default "image"</small> 850 </div> 851 <div class="form-group"><label >osCommerce Database User: </label><input class="form-control" type="text" name="store_user" value="<?php echo sanitize_text_field($_POST['store_user']); ?>"></div> 852 <div class="form-group"><label >osCommerce Database Password: </label><input class="form-control" type="text" name="store_pass" value="<?php echo sanitize_text_field($_POST['store_pass']); ?>"></div> 853 </div> 854 </div> 855 </div> 856 <div class="tab-pane fade modal-body bg-light" id="profile" role="tabpanel" aria-labelledby="profile-tab"> 819 857 <h3>Import data from osCommerce</h3> 820 <p>For big products database can import in steps</p> 821 <p><label class="control-label">Debug: <input type="checkbox" name="debug" value="1" <?php 822 if ($_POST['debug']) { 858 <div class="alert alert-info" role="alert"> 859 For big products database can import in steps (use fields Offset & Limit) 860 </div> 861 <div class="col-md-12"> 862 <div class="form-group"><label >Language: </label><input class="form-control" type="text" name="lang" value="<?php echo sanitize_text_field($_POST['lang']); ?>"><small>Id from osCommerce lang table</small></div> 863 <div class="form-group"><label >Offset: </label><input class="form-control" type="text" name="offset" value="<?php echo sanitize_text_field($_POST['offset']); ?>"><small>Last product imported</small></div> 864 <div class="form-group"><label >Limit: </label><input class="form-control" type="text" name="limit" value="<?php echo sanitize_text_field($_POST['limit']); ?>"><small>how many products imported</small></div> 865 </div> 866 867 </div> 868 <div class="tab-pane fade modal-body bg-light" id="contact" role="tabpanel" aria-labelledby="contact-tab"> 869 <h3>Data to Import:</h3> 870 <div class="alert alert-warning" role="alert"> 871 It is recommended to follow the order of the list 872 </div> 873 <div class="row"> 874 <div class="col-md-12"> 875 <label ><input class="form-control" type="checkbox" name="dtype[customers]" value="1" <?php 876 if ((int) $_POST['dtype']['customers']) { 877 echo " checked "; 878 } 879 ?>>Customers (passwords will not be transferred)</label><br> 880 881 <label ><input class="form-control" type="checkbox" name="dtype[categories]" value="1" <?php 882 if ((int) $_POST['dtype']['categories']) { 883 echo " checked "; 884 } 885 ?>>Categories</label><br> 886 <!-- <label ><input class="form-control" type="checkbox" name="dtype[taxes]" value="1" <?php 887 if ((int) $_POST['dtype']['taxes']) { 823 888 echo " checked "; 824 889 } 825 ?>></label><small>(Display and save a log file in WordPress root folder)</small></p> 826 <p><label class="control-label">Language (Id from osCommerce lang table): <input type="text" name="lang" value="<?php echo sanitize_text_field($_POST['lang']); ?>"></label></p> 827 <p><label class="control-label">Offset (Last product imported): <input type="text" name="offset" value="<?php echo sanitize_text_field($_POST['offset']); ?>"></label></p> 828 <p><label class="control-label">Limit (how many produts imported): <input type="text" name="limit" value="<?php echo sanitize_text_field($_POST['limit']); ?>"></label></p> 829 <p>Enter your oscommerce database information (you will need remote access to your oscommerce database)</p> 830 <p><label class="control-label">osCommerce store URL: <input type="text" name="store_url" value="<?php echo sanitize_text_field($_POST['store_url']); ?>"></label><label class="control-label"> Images directory: <small>(empty directory "image") </small><input type="text" name="images_url" value="<?php echo sanitize_text_field($_POST['images_url']); ?>"></label></p> 831 <p><label class="control-label">osCommerce Database Host: <input type="text" name="store_host" value="localhost"></label></p> 832 <p><label class="control-label">osCommerce Database User: <input type="text" name="store_user" value="<?php echo sanitize_text_field($_POST['store_user']); ?>"></label></p> 833 <p><label class="control-label">osCommerce Database Password: <input type="text" name="store_pass" value="<?php echo sanitize_text_field($_POST['store_pass']); ?>"></label></p> 834 <p><label class="control-label">osCommerce Database Name: <input type="text" name="store_dbname" value="<?php echo sanitize_text_field($_POST['store_dbname']); ?>"></label></p> 890 ?>>Taxes</label><br>--> 891 <label ><input class="form-control" type="checkbox" name="dtype[products]" value="1" <?php 892 if ((int) $_POST['dtype']['products']) { 893 echo " checked "; 894 } 895 ?>>Products</label><br> 896 <label ><input class="form-control" type="checkbox" name="dtype[delete]" value="1" <?php 897 if ((int) $_POST['dtype']['delete']) { 898 echo " checked "; 899 } 900 ?>>Products delete images </label><br> 901 <label ><input class="form-control" type="checkbox" name="dtype[image]" value="1" <?php 902 if ((int) $_POST['dtype']['image']) { 903 echo " checked "; 904 } 905 ?>>Products Prefered image</label><br> 906 <label ><input class="form-control" type="checkbox" name="dtype[gallery]" value="1" <?php 907 if ((int) $_POST['dtype']['gallery']) { 908 echo " checked "; 909 } 910 ?>>Products gallery</label><br> 911 <label ><input class="form-control" type="checkbox" name="dtype[orders]" value="1" <?php 912 if ((int) $_POST['dtype']['orders']) { 913 echo " checked "; 914 } 915 ?>>Orders</label><br> 916 <label ><input class="form-control" type="checkbox" name="dtype[pages]" value="1" <?php 917 if ((int) $_POST['dtype']['pages']) { 918 echo " checked "; 919 } 920 ?>>Information Pages</label> 921 922 923 </div> 924 </div> 925 835 926 </div> 836 <div class="col-md-6 form-control" style="background-color: #f1f1f1"> 837 <h3>Data to Import:</h3> 838 <h5>It is recommended to follow the order of the list</h5> 839 <label class="control-label"><input type="checkbox" name="dtype[customers]" value="1" <?php 840 if ((int) $_POST['dtype']['customers']) { 841 echo " checked "; 842 } 843 ?>>Customers (passwords will not be transferred)</label><br> 844 845 <label class="control-label"><input type="checkbox" name="dtype[categories]" value="1" <?php 846 if ((int) $_POST['dtype']['categories']) { 847 echo " checked "; 848 } 849 ?>>Categories</label><br> 850 <!-- <label class="control-label"><input type="checkbox" name="dtype[taxes]" value="1" <?php 851 if ((int) $_POST['dtype']['taxes']) { 852 echo " checked "; 853 } 854 ?>>Taxes</label><br>--> 855 <label class="control-label"><input type="checkbox" name="dtype[products]" value="1" <?php 856 if ((int) $_POST['dtype']['products']) { 857 echo " checked "; 858 } 859 ?>>Products</label><br> 860 <label class="control-label"><input type="checkbox" name="dtype[delete]" value="1" <?php 861 if ((int) $_POST['dtype']['delete']) { 862 echo " checked "; 863 } 864 ?>>Products delete images </label><br> 865 <label class="control-label"><input type="checkbox" name="dtype[image]" value="1" <?php 866 if ((int) $_POST['dtype']['image']) { 867 echo " checked "; 868 } 869 ?>>Products Prefered image</label><br> 870 <label class="control-label"><input type="checkbox" name="dtype[gallery]" value="1" <?php 871 if ((int) $_POST['dtype']['gallery']) { 872 echo " checked "; 873 } 874 ?>>Products gallery</label><br> 875 <label class="control-label"><input type="checkbox" name="dtype[orders]" value="1" <?php 876 if ((int) $_POST['dtype']['orders']) { 877 echo " checked "; 878 } 879 ?>>Orders</label><br> 880 <label class="control-label"><input type="checkbox" name="dtype[pages]" value="1" <?php 881 if ((int) $_POST['dtype']['pages']) { 882 echo " checked "; 883 } 884 ?>>Information Pages</label> 885 886 <p><input type="submit" value="Import Data" class="button button-primary button-large"></p> 887 </div> 888 </div> 927 </div> 928 <div class="form-group"><label >Debug: <input class="form-control" type="checkbox" name="debug" value="1" <?php 929 if ($_POST['debug']) { 930 echo " checked "; 931 } 932 ?>></label> 933 <small>(Display and save a log file in WordPress root folder)</small> 934 <div class="form-group"><input type="submit" value="Import Data" class="btn btn-primary btn-lg"></div> 935 </div> 936 889 937 </form> 890 938 <?php
Note: See TracChangeset
for help on using the changeset viewer.